Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
To run:
|
| 2 |
+
|
| 3 |
+
Stand up Inferentia inf2.8xlarge with Hugging Face AMI.
|
| 4 |
+
|
| 5 |
+
Update to 2.16:
|
| 6 |
+
```
|
| 7 |
+
sudo apt-get update -y \
|
| 8 |
+
&& sudo apt-get install -y --no-install-recommends \
|
| 9 |
+
aws-neuronx-dkms=2.15.9.0 \
|
| 10 |
+
aws-neuronx-collectives=2.19.7.0-530fb3064 \
|
| 11 |
+
aws-neuronx-runtime-lib=2.19.5.0-97e2d271b \
|
| 12 |
+
aws-neuronx-tools=2.16.1.0
|
| 13 |
+
|
| 14 |
+
pip3 install --upgrade \
|
| 15 |
+
neuronx-cc==2.12.54.0 \
|
| 16 |
+
torch-neuronx==1.13.1.1.13.0 \
|
| 17 |
+
transformers-neuronx==0.9.474 \
|
| 18 |
+
--extra-index-url=https://pip.repos.neuron.amazonaws.com
|
| 19 |
+
|
| 20 |
+
python3 -m pip install git+https://github.com/aws-neuron/transformers-neuronx.git
|
| 21 |
+
|
| 22 |
+
pip install git+https://github.com/huggingface/optimum.git
|
| 23 |
+
pip install git+https://github.com/huggingface/optimum-neuron.git
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
Then you should be able to run it right from the repository:
|
| 27 |
+
```
|
| 28 |
+
from optimum.neuron import NeuronStableDiffusionXLPipeline
|
| 29 |
+
pipeline = NeuronStableDiffusionXLPipeline.from_pretrained("jburtoft/TDXL", device_ids=[0, 1])
|
| 30 |
+
prompt = "a photo of an astronaut riding a horse on mars"
|
| 31 |
+
# generate image
|
| 32 |
+
image = pipeline(prompt).images[0]
|
| 33 |
+
image.save("generated_image.jpg")
|
| 34 |
+
```
|