license: openrail++ | |
tags: | |
- text-to-image | |
- stable-diffusion | |
- inferentia2 | |
- neuron | |
# Neuronx model for [stabilityai/stable-diffusion-xl-base-1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0) | |
This repository contains are AWS Inferentia2 and neuronx compatible checkpoint for [stabilityai/stable-diffusion-xl-base-1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0). You can find detailed information about the base model on its [Model Card](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0). | |
## Usage on Amazon SageMaker | |
_coming soon_ | |
## Usage with optimum-neuron | |
```python | |
from optimum.neuron import NeuronStableDiffusionXLPipeline | |
# Load pipeline from Hugging Face repository | |
pipeline = NeuronStableDiffusionXLPipeline.from_pretrained(model_dir, device_ids=[0, 1]) | |
# prompt for generating images | |
prompt = "a photo of an astronaut riding a horse on mars" | |
# generate image | |
image = stable_diffusion(prompt).images[0] | |
image.save("generated_image.jpg") | |
``` | |
## Compilation Arguments | |
**compilation arguments** | |
```json | |
{ | |
"auto_cast": "all", | |
"auto_cast_type": "bf16" | |
} | |
``` | |
**input_shapes** | |
```json | |
{ | |
"height": 1024, | |
"width": 1024, | |
"num_images_per_prompt": 1, | |
"batch_size": 1 | |
} | |
``` | |