|
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") |
|
``` |