recoilme commited on
Commit
d264d52
·
1 Parent(s): bf162a3

model_index: plain _class_name string, select the shipped pipeline with custom_pipeline

Browse files

Hub 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.

Files changed (2) hide show
  1. README.md +6 -4
  2. 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", trust_remote_code=True,
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
- `trust_remote_code=True` pulls `pipeline.py` and `transformer.py` from this repo and runs them, so
98
- no clone is needed. Cloning works too and gives the class directly:
 
 
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
+ }