Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,6 +45,7 @@ def download_hf_models(output_dir: Path) -> dict:
|
|
| 45 |
- DiffSynth-Studio/General-Image-Encoders
|
| 46 |
- Tongyi-MAI/Z-Image-Turbo
|
| 47 |
- Tongyi-MAI/Z-Image
|
|
|
|
| 48 |
|
| 49 |
Returns dict with paths to downloaded models.
|
| 50 |
"""
|
|
@@ -72,6 +73,11 @@ def download_hf_models(output_dir: Path) -> dict:
|
|
| 72 |
"description": "Z-Image base model (transformer)",
|
| 73 |
"allow_patterns": ["transformer/*.safetensors"],
|
| 74 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
]
|
| 76 |
|
| 77 |
downloaded_paths = {}
|
|
@@ -228,13 +234,17 @@ encoders_path = MODELS_DIR / "DiffSynth-Studio" / "General-Image-Encoders"
|
|
| 228 |
siglip_file = get_model_files(encoders_path, "SigLIP2-G384/model.safetensors")
|
| 229 |
dino_file = get_model_files(encoders_path, "DINOv3-7B/model.safetensors")
|
| 230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
print(f" Z-Image transformer: {len(zimage_transformer_files)} file(s)")
|
| 232 |
print(f" Text encoder: {len(text_encoder_files)} file(s)")
|
| 233 |
print(f" VAE: {len(vae_file)} file(s)")
|
| 234 |
print(f" Tokenizer: {tokenizer_path}")
|
| 235 |
print(f" SigLIP2: {len(siglip_file)} file(s)")
|
| 236 |
print(f" DINOv3: {len(dino_file)} file(s)")
|
| 237 |
-
print(f" Z-Image-i2L:
|
| 238 |
|
| 239 |
# Validate files
|
| 240 |
missing = []
|
|
@@ -244,6 +254,7 @@ if not vae_file: missing.append("VAE")
|
|
| 244 |
if not tokenizer_path.exists(): missing.append("Tokenizer")
|
| 245 |
if not siglip_file: missing.append("SigLIP2")
|
| 246 |
if not dino_file: missing.append("DINOv3")
|
|
|
|
| 247 |
|
| 248 |
if missing:
|
| 249 |
raise FileNotFoundError(f"Missing model files: {', '.join(missing)}")
|
|
@@ -251,18 +262,16 @@ if missing:
|
|
| 251 |
# Step 5: Load pipeline
|
| 252 |
print()
|
| 253 |
print("🚀 Step 5: Loading Z-Image pipeline...")
|
| 254 |
-
print("
|
| 255 |
-
print(" Z-Image-i2L: loading from ModelScope...")
|
| 256 |
|
| 257 |
model_configs = [
|
| 258 |
-
#
|
| 259 |
ModelConfig(path=zimage_transformer_files, **vram_config),
|
| 260 |
ModelConfig(path=text_encoder_files),
|
| 261 |
ModelConfig(path=vae_file),
|
| 262 |
ModelConfig(path=siglip_file),
|
| 263 |
ModelConfig(path=dino_file),
|
| 264 |
-
|
| 265 |
-
ModelConfig(model_id="DiffSynth-Studio/Z-Image-i2L", origin_file_pattern="model.safetensors"),
|
| 266 |
]
|
| 267 |
|
| 268 |
pipe = ZImagePipeline.from_pretrained(
|
|
@@ -454,7 +463,7 @@ def create_demo():
|
|
| 454 |
|
| 455 |
gr.Markdown("""
|
| 456 |
---
|
| 457 |
-
**Resources:** [Z-Image-i2L](https://
|
| 458 |
[DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio) |
|
| 459 |
**Settings:** CFG=4, Sigma Shift=8, Steps=50
|
| 460 |
""")
|
|
|
|
| 45 |
- DiffSynth-Studio/General-Image-Encoders
|
| 46 |
- Tongyi-MAI/Z-Image-Turbo
|
| 47 |
- Tongyi-MAI/Z-Image
|
| 48 |
+
- multimodalart/Z-Image-i2L
|
| 49 |
|
| 50 |
Returns dict with paths to downloaded models.
|
| 51 |
"""
|
|
|
|
| 73 |
"description": "Z-Image base model (transformer)",
|
| 74 |
"allow_patterns": ["transformer/*.safetensors"],
|
| 75 |
},
|
| 76 |
+
{
|
| 77 |
+
"repo_id": "multimodalart/Z-Image-i2L",
|
| 78 |
+
"description": "Z-Image-i2L (Image to LoRA model)",
|
| 79 |
+
"allow_patterns": ["*.safetensors"],
|
| 80 |
+
},
|
| 81 |
]
|
| 82 |
|
| 83 |
downloaded_paths = {}
|
|
|
|
| 234 |
siglip_file = get_model_files(encoders_path, "SigLIP2-G384/model.safetensors")
|
| 235 |
dino_file = get_model_files(encoders_path, "DINOv3-7B/model.safetensors")
|
| 236 |
|
| 237 |
+
# Z-Image-i2L from HuggingFace
|
| 238 |
+
zimage_i2l_path = MODELS_DIR / "multimodalart" / "Z-Image-i2L"
|
| 239 |
+
zimage_i2l_file = get_model_files(zimage_i2l_path, "model.safetensors")
|
| 240 |
+
|
| 241 |
print(f" Z-Image transformer: {len(zimage_transformer_files)} file(s)")
|
| 242 |
print(f" Text encoder: {len(text_encoder_files)} file(s)")
|
| 243 |
print(f" VAE: {len(vae_file)} file(s)")
|
| 244 |
print(f" Tokenizer: {tokenizer_path}")
|
| 245 |
print(f" SigLIP2: {len(siglip_file)} file(s)")
|
| 246 |
print(f" DINOv3: {len(dino_file)} file(s)")
|
| 247 |
+
print(f" Z-Image-i2L: {len(zimage_i2l_file)} file(s)")
|
| 248 |
|
| 249 |
# Validate files
|
| 250 |
missing = []
|
|
|
|
| 254 |
if not tokenizer_path.exists(): missing.append("Tokenizer")
|
| 255 |
if not siglip_file: missing.append("SigLIP2")
|
| 256 |
if not dino_file: missing.append("DINOv3")
|
| 257 |
+
if not zimage_i2l_file: missing.append("Z-Image-i2L")
|
| 258 |
|
| 259 |
if missing:
|
| 260 |
raise FileNotFoundError(f"Missing model files: {', '.join(missing)}")
|
|
|
|
| 262 |
# Step 5: Load pipeline
|
| 263 |
print()
|
| 264 |
print("🚀 Step 5: Loading Z-Image pipeline...")
|
| 265 |
+
print(" All models loaded from HuggingFace local paths")
|
|
|
|
| 266 |
|
| 267 |
model_configs = [
|
| 268 |
+
# All models from HuggingFace - use path= for local files
|
| 269 |
ModelConfig(path=zimage_transformer_files, **vram_config),
|
| 270 |
ModelConfig(path=text_encoder_files),
|
| 271 |
ModelConfig(path=vae_file),
|
| 272 |
ModelConfig(path=siglip_file),
|
| 273 |
ModelConfig(path=dino_file),
|
| 274 |
+
ModelConfig(path=zimage_i2l_file),
|
|
|
|
| 275 |
]
|
| 276 |
|
| 277 |
pipe = ZImagePipeline.from_pretrained(
|
|
|
|
| 463 |
|
| 464 |
gr.Markdown("""
|
| 465 |
---
|
| 466 |
+
**Resources:** [Z-Image-i2L (HuggingFace)](https://huggingface.co/multimodalart/Z-Image-i2L) |
|
| 467 |
[DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio) |
|
| 468 |
**Settings:** CFG=4, Sigma Shift=8, Steps=50
|
| 469 |
""")
|