File size: 1,093 Bytes
a11adad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
To run:

Stand up Inferentia inf2.8xlarge with Hugging Face AMI.

Update to 2.16:
```
sudo apt-get update -y \
 && sudo apt-get install -y --no-install-recommends \
    aws-neuronx-dkms=2.15.9.0 \
    aws-neuronx-collectives=2.19.7.0-530fb3064 \
    aws-neuronx-runtime-lib=2.19.5.0-97e2d271b \
    aws-neuronx-tools=2.16.1.0 

pip3 install --upgrade \
    neuronx-cc==2.12.54.0 \
    torch-neuronx==1.13.1.1.13.0 \
    transformers-neuronx==0.9.474 \
    --extra-index-url=https://pip.repos.neuron.amazonaws.com

python3 -m pip install git+https://github.com/aws-neuron/transformers-neuronx.git

pip install git+https://github.com/huggingface/optimum.git
pip install git+https://github.com/huggingface/optimum-neuron.git
```

Then you should be able to run it right from the repository:
```
from optimum.neuron import NeuronStableDiffusionXLPipeline
pipeline = NeuronStableDiffusionXLPipeline.from_pretrained("jburtoft/TDXL", device_ids=[0, 1])
prompt = "a photo of an astronaut riding a horse on mars"
# generate image
image = pipeline(prompt).images[0]
image.save("generated_image.jpg")
```