Instructions to use sudo-ai/zero123plus-v1.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use sudo-ai/zero123plus-v1.1 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("sudo-ai/zero123plus-v1.1", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -8,19 +8,28 @@ tags:
|
|
| 8 |
- art
|
| 9 |
---
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
1. Copy or download `inference.py` from files.
|
| 14 |
-
2. Build a `Zero123PlusPipeline` with the checkpoint.
|
| 15 |
-
|
| 16 |
-
Example usage:
|
| 17 |
|
|
|
|
| 18 |
```python
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
pipeline.to('cuda:0')
|
| 21 |
-
pipeline
|
| 22 |
-
|
| 23 |
-
).images[0]
|
|
|
|
|
|
|
| 24 |
```
|
| 25 |
-
|
| 26 |
-
Condition needs to be in gray (127, 127, 127) or transparent (recommended) background.
|
|
|
|
| 8 |
- art
|
| 9 |
---
|
| 10 |
|
| 11 |
+
Recommended version of `diffusers` is `0.20.2` with `torch` `2`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
Usage Example:
|
| 14 |
```python
|
| 15 |
+
import torch
|
| 16 |
+
import requests
|
| 17 |
+
from PIL import Image
|
| 18 |
+
from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler
|
| 19 |
+
|
| 20 |
+
# Load the pipeline
|
| 21 |
+
pipeline = DiffusionPipeline.from_pretrained(
|
| 22 |
+
"sudo-ai/zero123plus-v1.1", custom_pipeline="sudo-ai/zero123plus-pipeline",
|
| 23 |
+
torch_dtype=torch.float16
|
| 24 |
+
)
|
| 25 |
+
# Feel free to tune the scheduler
|
| 26 |
+
pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(
|
| 27 |
+
pipeline.scheduler.config, timestep_spacing='trailing'
|
| 28 |
+
)
|
| 29 |
pipeline.to('cuda:0')
|
| 30 |
+
# Run the pipeline
|
| 31 |
+
cond = Image.open(requests.get("https://d.skis.ltd/nrp/sample-data/lysol.png", stream=True).raw)
|
| 32 |
+
result = pipeline(cond).images[0]
|
| 33 |
+
result.show()
|
| 34 |
+
result.save("output.png")
|
| 35 |
```
|
|
|
|
|
|