File size: 1,601 Bytes
3d02642
 
 
 
 
 
 
 
 
 
feaefa2
3d02642
 
 
4e9e125
3d02642
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8cff72a
 
3d02642
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
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 AWS Inferentia2 and neuronx compatible checkpoints 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

Read more in [Deploy Stable Diffusion XL on AWS inferentia2 with Amazon SageMaker](https://www.philschmid.de/inferentia2-stable-diffusion-xl)

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

This repository contains branches specific to versions of neuronx. When using with optimum-neuron, use the repo revision specific to the version of neuronx you are using, to load the right serialized checkpoints.

## 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
}
```