feat: Updated Usage
Browse files
README.md
CHANGED
@@ -195,33 +195,64 @@ This repo is contains ONNX checkpoints version of the model.
|
|
195 |
- **License**: [Fair AI Public License 1.0-SD](https://freedevproject.org/faipl-1.0-sd/)
|
196 |
- **Fine-tuned from**: [Animagine XL 3.0](https://huggingface.co/cagliostrolab/animagine-xl-3.0)
|
197 |
|
198 |
-
##
|
199 |
|
200 |
-
|
201 |
|
202 |
-
|
|
|
|
|
203 |
|
204 |
## 🧨 Diffusers Installation
|
205 |
|
|
|
|
|
206 |
First install the required libraries:
|
207 |
|
208 |
```bash
|
209 |
-
pip install
|
210 |
```
|
211 |
|
212 |
Then run image generation with the following example code:
|
213 |
|
214 |
```python
|
215 |
-
import
|
216 |
-
|
217 |
-
|
218 |
-
pipe =
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
pipe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
|
226 |
prompt = "1girl, souryuu asuka langley, neon genesis evangelion, solo, upper body, v, smile, looking at viewer, outdoors, night"
|
227 |
negative_prompt = "nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]"
|
|
|
195 |
- **License**: [Fair AI Public License 1.0-SD](https://freedevproject.org/faipl-1.0-sd/)
|
196 |
- **Fine-tuned from**: [Animagine XL 3.0](https://huggingface.co/cagliostrolab/animagine-xl-3.0)
|
197 |
|
198 |
+
## Jupyter Notebooks
|
199 |
|
200 |
+
**Note**: Both Colab and Sagemaker Studio Lab does not have enough VRAM or RAM to run the inference.
|
201 |
|
202 |
+
Open the demo in Kaggle: [![Open In Kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://www.kaggle.com/code/ecyht2/animagine-xl-onnx-demo)
|
203 |
+
|
204 |
+
Open the demo in Google Colab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/#fileId=https%3A//storage.googleapis.com/kaggle-colab-exported-notebooks/animagine-xl-onnx-demo-d5438574-4c5e-4a6b-8a1b-46c111a13e4d.ipynb%3FX-Goog-Algorithm%3DGOOG4-RSA-SHA256%26X-Goog-Credential%3Dgcp-kaggle-com%2540kaggle-161607.iam.gserviceaccount.com/20240413/auto/storage/goog4_request%26X-Goog-Date%3D20240413T140328Z%26X-Goog-Expires%3D259200%26X-Goog-SignedHeaders%3Dhost%26X-Goog-Signature%3D6262d18ddace3586153ef4f84b7b5486a7f868e3f2e32732510f4c3f0f470f1b544a6c7a9d839dac3ed9e9697bf8f0830821c30df76d66d06ac779554c30b814629b4d077acdb278e610b887c5ea443e2dd362fb52f796da876ffba8fc9de9e720aab0e1833cfb7dca9cc557c282a7aef8a2f21b174351cfb9a79ae0dd1b9ac24fca9d7854d4e45929fe31c861ee9a017d4dc9d859420493d897ff7ecb44b703013df1f7dd2699bb735ec5e2fd4838b12cd77ce68474772508f1e025b1e0037aea29fe0e9d79e1fb9d531933fc1c75c57d00f3d0cf3eb15851b7704be53116511d420d73e0d24e7d74f8f7df59a52c2614bd6cc915d2250c7b64e714dab6f8d5)
|
205 |
|
206 |
## 🧨 Diffusers Installation
|
207 |
|
208 |
+
### CPU Inference
|
209 |
+
|
210 |
First install the required libraries:
|
211 |
|
212 |
```bash
|
213 |
+
pip install iffusers "optimum[onnxruntime]" --upgrade
|
214 |
```
|
215 |
|
216 |
Then run image generation with the following example code:
|
217 |
|
218 |
```python
|
219 |
+
from optimum.onnxruntime import ORTStableDiffusionXLPipeline
|
220 |
+
|
221 |
+
base = "ecyht2/animagine-xl-3.1-onnx"
|
222 |
+
pipe = ORTStableDiffusionXLPipeline.from_pretrained(base)
|
223 |
+
pipe.to("cpu")
|
224 |
+
|
225 |
+
prompt = "1girl, souryuu asuka langley, neon genesis evangelion, solo, upper body, v, smile, looking at viewer, outdoors, night"
|
226 |
+
negative_prompt = "nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]"
|
227 |
+
|
228 |
+
image = pipe(
|
229 |
+
prompt,
|
230 |
+
negative_prompt=negative_prompt,
|
231 |
+
width=832,
|
232 |
+
height=1216,
|
233 |
+
guidance_scale=7,
|
234 |
+
num_inference_steps=28
|
235 |
+
).images[0]
|
236 |
+
|
237 |
+
image.save("./output/asuka_test.png")
|
238 |
+
```
|
239 |
+
|
240 |
+
### GPU Inference
|
241 |
+
|
242 |
+
First install the required libraries:
|
243 |
+
|
244 |
+
```bash
|
245 |
+
pip install iffusers "optimum[onnxruntime-gpu]" --upgrade
|
246 |
+
```
|
247 |
+
|
248 |
+
Then run image generation with the following example code:
|
249 |
+
|
250 |
+
```python
|
251 |
+
from optimum.onnxruntime import ORTStableDiffusionXLPipeline
|
252 |
+
|
253 |
+
base = "ecyht2/animagine-xl-3.1-onnx"
|
254 |
+
pipe = ORTStableDiffusionXLPipeline.from_pretrained(base)
|
255 |
+
pipe.to("cuda")
|
256 |
|
257 |
prompt = "1girl, souryuu asuka langley, neon genesis evangelion, solo, upper body, v, smile, looking at viewer, outdoors, night"
|
258 |
negative_prompt = "nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]"
|