Image-to-Image
Diffusers
Safetensors
ZenImageEditPipeline
text-to-image
image-editing
qwen-image
text-encoder
adapter
Instructions to use AiArtLab/zen-image-edit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use AiArtLab/zen-image-edit 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("AiArtLab/zen-image-edit", 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
model_index: plain _class_name string, select the shipped pipeline with custom_pipeline
Browse filesHub tooling requires _class_name to be a string, while the [file, class] form diffusers accepts for
custom pipelines makes it print a configuration warning. A string plus custom_pipeline="pipeline"
resolves the same class (verified against the Hub) without the warning.
- README.md +6 -4
- model_index.json +2 -5
README.md
CHANGED
|
@@ -77,8 +77,8 @@ Every image below is generated by this pipeline with 30 steps at 1024 px.
|
|
| 77 |
import torch
|
| 78 |
from diffusers import DiffusionPipeline
|
| 79 |
|
| 80 |
-
pipe = DiffusionPipeline.from_pretrained("AiArtLab/zen-image-edit",
|
| 81 |
-
dtype=torch.float16)
|
| 82 |
pipe.enable_model_cpu_offload() # 14.5 GB DiT + fp32 VAE decoder do not co-reside on 32 GB
|
| 83 |
|
| 84 |
# text-to-image
|
|
@@ -94,8 +94,10 @@ image = pipe(prompt="Replace the woman in <image2> with the woman from <image1>;
|
|
| 94 |
generator=torch.Generator("cuda").manual_seed(1234)).images[0]
|
| 95 |
```
|
| 96 |
|
| 97 |
-
`
|
| 98 |
-
no clone is needed.
|
|
|
|
|
|
|
| 99 |
|
| 100 |
```python
|
| 101 |
from pipeline import ZenImageEditPipeline
|
|
|
|
| 77 |
import torch
|
| 78 |
from diffusers import DiffusionPipeline
|
| 79 |
|
| 80 |
+
pipe = DiffusionPipeline.from_pretrained("AiArtLab/zen-image-edit", custom_pipeline="pipeline",
|
| 81 |
+
trust_remote_code=True, dtype=torch.float16)
|
| 82 |
pipe.enable_model_cpu_offload() # 14.5 GB DiT + fp32 VAE decoder do not co-reside on 32 GB
|
| 83 |
|
| 84 |
# text-to-image
|
|
|
|
| 94 |
generator=torch.Generator("cuda").manual_seed(1234)).images[0]
|
| 95 |
```
|
| 96 |
|
| 97 |
+
`custom_pipeline="pipeline"` builds the shipped `pipeline.py` and `trust_remote_code=True` lets it run,
|
| 98 |
+
so no clone is needed. (`_class_name` is kept a plain string in `model_index.json` because that is what
|
| 99 |
+
Hub tooling expects; the `[file, class]` form diffusers also accepts makes the Hub print a
|
| 100 |
+
configuration warning.) Cloning works too and gives the class directly:
|
| 101 |
|
| 102 |
```python
|
| 103 |
from pipeline import ZenImageEditPipeline
|
model_index.json
CHANGED
|
@@ -1,8 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"_class_name":
|
| 3 |
-
"pipeline",
|
| 4 |
-
"ZenImageEditPipeline"
|
| 5 |
-
],
|
| 6 |
"_diffusers_version": "0.41.0.dev0",
|
| 7 |
"processor": [
|
| 8 |
"transformers",
|
|
@@ -24,4 +21,4 @@
|
|
| 24 |
"diffusers",
|
| 25 |
"AutoencoderKLQwenImage21"
|
| 26 |
]
|
| 27 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"_class_name": "ZenImageEditPipeline",
|
|
|
|
|
|
|
|
|
|
| 3 |
"_diffusers_version": "0.41.0.dev0",
|
| 4 |
"processor": [
|
| 5 |
"transformers",
|
|
|
|
| 21 |
"diffusers",
|
| 22 |
"AutoencoderKLQwenImage21"
|
| 23 |
]
|
| 24 |
+
}
|