No setup. No install. No GPU? No problem.
Open notebook in Google Colab, set runtime to T4, and run — it's that simple.
Tags: fp8 comfyui diffusion image-generation colab-notebook text-to-image model-quantization huggingface python
Quick Navigation
| Section | Description |
|---|---|
| 📖 Overview | What is Z-Image Turbo Pro? |
| 📂 Project Structure | Repository layout |
| 🧩 Architecture | Pipeline flow diagram |
| ⚙️ Pipeline Components | Models and tools used |
| 🚀 Quick Start | Get running in 3 steps |
| 🎛️ Generation Parameters | All configurable options |
| 📊 Samplers & Schedulers | Denoising algorithms explained |
| 📐 Supported Resolutions | Aspect ratios and sizes |
| 💡 How It Works | Step-by-step sequence |
| 🧠 Model Details | Technical specs of each component |
| 🔋 Resource Requirements | GPU, RAM, disk specs |
| 🐍 Python Modules | Modular source code reference |
| 🖼️ Preview | Example prompts and output previews |
| 🧪 Tips & Tricks | Get the best results |
| ❓ FAQ | Common questions answered |
| 🐛 Troubleshooting | Fix common issues |
| 🙏 Acknowledgements | Credits and references |
| 🤝 Contributing | How to contribute |
| 📜 License | MIT license details |
| ⭐ Star History | Community growth chart |
Z-Image Turbo Pro is a next-gen FP8 diffusion pipeline with ComfyUI backend and smart caching. Professional-grade image generation on free Colab hardware — zero setup, zero configuration.
Note
Why FP8? FP8 (8-bit floating point) quantization cuts VRAM usage nearly in half compared to full precision while preserving output quality. This enables pro-grade image generation on free T4 GPUs — no paid Colab tier required.
Warning
Content Safety Notice: Z-Image is an unfiltered diffusion model. It does not have built-in NSFW filters. Users are solely responsible for the content they generate. Do not use this tool to create illegal, harmful, or non-consensual content. By using this project, you agree to comply with all applicable laws and the HuggingFace content policy. The authors assume no liability for misuse.
| Feature | Description |
|---|---|
| ⚡ FP8 Optimized | Half the VRAM, full quality — runs on free T4 Colab |
| 💾 Smart Cache | Models cached in Google Drive — instant on restart |
| 🎯 One-Click | Zero configuration — just open and run |
| 🔋 GPU Ready | Free Google Colab T4 is sufficient |
| ⚙️ ComfyUI Backend | Node-based pipeline engine — battle-tested and extensible |
| 🌐 aria2c Downloader | 16-connection parallel downloads for fast model fetching |
| 🧹 Auto-Cleanup | Clear old outputs and Drive cache to free disk space |
| 🔧 Modular Source | Clean src/ package — easy to extend and maintain |
| Component | File | Purpose |
|---|---|---|
| Notebook | notebook/ZImagePro.ipynb |
4-cell Colab notebook — the main entry point |
| Config | src/config.py |
Constants, defaults, model URLs, resolution presets |
| Downloader | src/downloader.py |
aria2c/GDrive/Civitai asset fetcher |
| Generator | src/generator.py |
In-process ComfyUI node loading + image generation |
| Exporter | src/exporter.py |
Zip and download generated images |
| Guide | GUIDE.md |
Comprehensive beginner-friendly user guide |
| Prompts | PROMPT.md |
8 ready-to-use example prompts with settings |
| Contributing | CONTRIBUTING.md |
How to contribute (bugs, features, code) |
| License | LICENSE |
MIT license text |
| Changelog | CHANGELOG.md |
Version history with dates and descriptions |
ZImagePro/
├── CHANGELOG.md # Version history (newest first)
├── CONTRIBUTING.md # How to contribute (bugs, features, code)
├── GUIDE.md # Comprehensive beginner-friendly user guide
├── LICENSE # MIT
├── PROMPT.md # 8 example prompts with settings
├── README.md # This file
├── SECURITY.md # Vulnerability reporting policy
├── .gitignore # Python, Jupyter, model files, OS artifacts
├── requirements.txt # Python dependencies
│
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md # Bug report template
│ │ └── feature_request.md # Feature request template
│ └── PULL_REQUEST_TEMPLATE.md # PR checklist
│
├── notebook/
│ └── ZImagePro.ipynb # Main Colab notebook (4 code cells + 3 markdown)
│
└── src/
├── __init__.py # Package marker + shared UI logger + run_quiet helper
├── config.py # All constants and default parameters
├── downloader.py # Asset download engine (aria2c, GDrive, Civitai)
├── generator.py # In-process ComfyUI node loader + image generator
└── exporter.py # Output zip + Colab download helper
flowchart TD
A["📝 User Prompt"] --> B["CLIP Encode\n(Qwen 3 4B)"]
B --> C["Empty Latent\n(Image Format)"]
C --> D["KSampler\n(20 steps, euler)"]
D --> E["VAE Decode\n(ae.safetensors)"]
E --> F["🖼️ Generated Image"]
G["Z-Image Turbo FP8\n(Base Model)"] --> D
H["ModelSamplingAuraFlow\n(Shift: 3.0)"] --> D
style A fill:#0d1117,stroke:#58a6ff,color:#e6edf3,stroke-width:2px
style F fill:#0d1117,stroke:#3fb950,color:#e6edf3,stroke-width:2px
style G fill:#0d1117,stroke:#a371f7,color:#e6edf3,stroke-width:2px
style H fill:#0d1117,stroke:#f97316,color:#e6edf3,stroke-width:2px
flowchart TD
subgraph Text["📝 Text Encoding"]
CLIP["CLIPLoader\nqwen_3_4b.safetensors\n(lumina2)"]
POS["CLIPTextEncode\nPositive Prompt"]
NEG["CLIPTextEncode\nNegative Prompt"]
CLIP --> POS
CLIP --> NEG
end
subgraph Latent["🖼️ Latent Space"]
EMPTY["EmptyLatentImage\n1024×1024, batch=1"]
end
subgraph Model["🧠 Model Loading"]
UNET["UNETLoader\nFP8 (.safetensors)"]
end
subgraph Sample["⚡ Sampling"]
KS["KSampler\n20 steps · euler\nsimple scheduler · CFG 1.0"]
end
subgraph Output["💾 Output"]
VAE_D["VAEDecode\nae.safetensors"]
SAVE["SaveImage\nz-image-pro prefix"]
VAE_D --> SAVE
end
VAE["VAELoader\nae.safetensors"]
UNET --> KS
POS --> KS
NEG --> KS
EMPTY --> KS
KS --> VAE_D
VAE --> VAE_D
style Text fill:#0d1117,stroke:#58a6ff,color:#e6edf3
style Latent fill:#0d1117,stroke:#a371f7,color:#e6edf3
style Model fill:#0d1117,stroke:#f0c14b,color:#e6edf3
style Sample fill:#0d1117,stroke:#f97316,color:#e6edf3
style Output fill:#0d1117,stroke:#3fb950,color:#e6edf3
| Component | Model / Config | Type | Size | Purpose |
|---|---|---|---|---|
| Base Model | Z-Image Turbo FP8 | UNet | ~4 GB | FP8 quantized diffusion backbone — generates latents |
| Text Encoder | qwen_3_4b.safetensors |
CLIP | ~2.5 GB | Encodes text prompts into conditioning vectors |
| VAE Decoder | ae.safetensors |
VAE | ~300 MB | Decodes latent tensors into pixel-space images |
| AuraFlow Sampler | ModelSamplingAuraFlow |
Node | — | Applies shift parameter to the sampling schedule |
| KSampler | euler |
Node | — | Iterative denoising — runs the actual generation |
| Step | Cell | What Happens | Duration |
|---|---|---|---|
| 🛠️ | 1. Initialize | Clone ZImagePro repo, clone ComfyUI, install Python deps, install aria2c, mount Drive, check cache, download models | ~3–5 min (first) / ~30s (cached) |
| 🚀 | 2. Load & Generate | Load FP8 weights into VRAM, configure prompt & settings, generate image | ~30 sec |
| 💾 | 3. Export | Zip all output PNGs and trigger browser download | ~5 sec |
| 🧹 | 4. Cache & Cleanup | Clear Drive cache, clean old outputs, free disk space | ~5 sec |
Prefer Kaggle? Import the notebook:
- Go to kaggle.com/code → New Notebook
- File → Import Notebook → paste this URL:
https://raw.githubusercontent.com/Shineii86/ZImagePro/main/notebook/ZImagePro-Kaggle.ipynb
- Sidebar ⚙️ → Accelerator → GPU T4 x2
- Sidebar ⚙️ → Internet → On
- Run all cells — same workflow, same results
💡 Tip: Kaggle gives 30 hours/week of free GPU. Great alternative when Colab quota is exhausted.
Cell 1 — Initialize
# Clones the ZImagePro repo (provides src/ modules)
# Clones ComfyUI (the pipeline engine)
# Installs: xformers, torch, comfyui deps
# Installs aria2c system package
# Mounts Google Drive for persistent model cache
# Checks cache status (hit/miss per model with sizes)
# Downloads: UNet FP8 model, text encoder, VAE (via aria2c 16-parallel)
# Saves to Drive cache after first downloadCell 2 — Load & Generate
# Loads UNet, CLIP, VAE models into VRAM via src.generator.load_models()
# Reports VRAM usage (allocated / total)
# Encodes positive/negative prompts via CLIP
# Creates empty latent, runs KSampler denoising
# Decodes through VAE, saves PNG to /content/results
# Displays image inline with generation timingCell 3 — Export
# Shows output count and total size
# Zips all .png files from /content/results
# Triggers browser download via google.colab.files APICell 4 — Cache & Cleanup
# Shows disk space, output stats, Drive cache status
# Optional: Clear Drive cache (reclaim ~7 GB)
# Optional: Clean old outputs (with keep-latest option)| Parameter | Type | Default | Description |
|---|---|---|---|
positive_prompt |
String | "" |
Positive prompt — describe what you want to see |
negative_prompt |
String | "blurry, low quality, text, watermark, distorted" |
Negative prompt — what to avoid |
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
width |
Int | 1024 |
512–2048 (step 64) | Output width in pixels |
height |
Int | 1024 |
512–2048 (step 64) | Output height in pixels |
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
steps |
Int | 20 |
10–50 | Denoising iterations — more steps = more detail but slower |
cfg |
Float | 1.0 |
1.0–10.0 | Classifier-Free Guidance scale — how closely to follow the prompt |
sampler_name |
String | "euler" |
See list below | Denoising algorithm |
scheduler |
String | "simple" |
See list below | Noise schedule type |
seed |
Int | -1 |
-1–∞ | RNG seed. -1 = random each time. Same seed = reproducible output |
| Sampler | Speed | Quality | Best For |
|---|---|---|---|
euler |
⚡⚡⚡ | ⭐⭐⭐⭐ | Default — fast, clean results |
euler_ancestral |
⚡⚡⚡ | ⭐⭐⭐⭐ | More variation, slightly noisy |
res_multistep |
⚡⚡⚡ | ⭐⭐⭐⭐⭐ | Best overall for Z-Image |
dpmpp_2m |
⚡⚡ | ⭐⭐⭐⭐⭐ | High quality, slower |
dpmpp_2m_sde |
⚡⚡ | ⭐⭐⭐⭐⭐ | Excellent detail |
dpmpp_3m_sde |
⚡ | ⭐⭐⭐⭐⭐ | Best quality, slowest |
lcm |
⚡⚡⚡⚡ | ⭐⭐⭐ | Ultra-fast, lower quality |
ddim |
⚡⚡⚡ | ⭐⭐⭐ | Deterministic, predictable |
uni_pc |
⚡⚡ | ⭐⭐⭐⭐ | Good balance |
| Scheduler | Description |
|---|---|
simple |
Default — simple linear interpolation |
beta |
Beta distribution schedule — excellent for Z-Image |
normal |
Standard linear schedule |
karras |
Karras noise schedule — popular for SD models |
exponential |
Exponential decay schedule |
sgm_uniform |
Uniform schedule from SGM |
ddim_uniform |
DDIM-style uniform schedule |
| Aspect Ratio | Resolution | Megapixels | Best For |
|---|---|---|---|
| 1:1 | 1024 × 1024 | 1.05 MP | Avatars, social media posts, profile pictures |
| 16:9 | 1280 × 720 | 0.92 MP | YouTube thumbnails, desktop wallpapers, presentations |
| 9:16 | 720 × 1280 | 0.92 MP | Mobile wallpapers, Instagram/TikTok stories |
| 4:3 | 1152 × 864 | 1.00 MP | Classic photography, print layouts |
| 21:9 | 1344 × 576 | 0.77 MP | Ultrawide monitors, cinematic compositions |
💡 Custom resolutions: The notebook supports any resolution from 512×512 to 2048×2048 (step 64). Use the slider inputs or type directly.
sequenceDiagram
participant U as 👤 User
participant NB as 📓 Notebook
participant SRC as 📦 src/ Package
participant DRV as 💾 Drive Cache
participant CUI as ⚙️ ComfyUI
participant GPU as 🖥️ T4 GPU
U->>NB: Run Cell 1 (Initialize)
NB->>NB: Clone ZImagePro + ComfyUI repos
NB->>NB: Install deps + aria2c
NB->>DRV: Mount Google Drive
NB->>SRC: Import config, downloader modules
SRC->>DRV: Check cache status (hit/miss per model)
alt Cache Hit
DRV-->>SRC: Models found in Drive (~30s copy)
else Cache Miss
SRC->>SRC: aria2c 16-parallel download (~5 min)
SRC->>DRV: Save models to Drive cache
end
SRC-->>NB: ✅ Models ready
U->>NB: Run Cell 2 (Load & Generate)
NB->>SRC: load_models()
SRC->>CUI: Load UNet + CLIP + VAE into VRAM
CUI-->>SRC: Models ready + VRAM stats
NB->>SRC: generate_image(params)
SRC->>CUI: CLIP encode + KSampler + VAE decode
GPU-->>CUI: Pixel image
SRC-->>NB: PIL Image + save path + timing
NB->>NB: Display inline image
U->>NB: Run Cell 3 (Export)
NB->>SRC: zip_outputs() + download_zip()
SRC-->>U: 📥 Z_Image_Pro_Artworks.zip
U->>NB: Run Cell 4 (Cleanup) [optional]
NB->>DRV: Clear cache / Clean old outputs
NB-->>U: ✅ Disk space freed
| Property | Value |
|---|---|
| Architecture | Diffusion Transformer (DiT) |
| Quantization | FP8 (8-bit floating point) |
| Resolution | Trained at 1024×1024 |
| Backbone | Z-Image Turbo |
| HuggingFace | T5B/Z-Image-Turbo-FP8 |
| Property | Value |
|---|---|
| Architecture | Qwen 3 (4B parameters) |
| Purpose | Text → conditioning vectors for CLIP guidance |
| Format | qwen_3_4b.safetensors |
| Loader | CLIPLoader with lumina2 type |
| Property | Value |
|---|---|
| File | ae.safetensors |
| Purpose | Decode latent space tensors → RGB pixel images |
| Latent Format | Standard (EmptyLatentImage) |
| Resource | Minimum | Recommended | Notes |
|---|---|---|---|
| GPU | T4 (16 GB VRAM) | T4 or better | Free on Google Colab |
| System RAM | 12 GB | 16 GB | ComfyUI + model loading |
| Disk Space | ~8 GB (base) | 15 GB | Base models + outputs |
| Python | 3.10+ | Colab default | Required for torch/ComfyUI |
| Internet | Required | Stable connection | For model downloads (first run only) |
| Component | Size | Cached? |
|---|---|---|
| ComfyUI + deps | ~2 GB | Yes (Colab session) |
| Z-Image FP8 UNet | ~4 GB | Yes |
| Qwen 3 4B Encoder | ~2.5 GB | Yes |
| VAE | ~300 MB | Yes |
| Output (per image) | ~2–5 MB | No |
💡 First run takes ~5–8 minutes for downloads. Models are automatically cached to Google Drive — subsequent sessions skip the download entirely (~30s copy from Drive).
The src/ package contains the modular pipeline code. Each module has a specific responsibility:
All constants and defaults in one place.
from src.config import WORKSPACE, MODEL_DIRS, DEFAULTS, RESOLUTIONS, SAMPLERS, SCHEDULERS
# Example: get default generation params
print(DEFAULTS["steps"]) # 20
print(RESOLUTIONS["16:9"]) # (1280, 720)Asset fetching with aria2c acceleration and Google Drive caching.
from src.downloader import ensure_aria2, mount_drive, download_file, get_cache_status, clear_cache
ensure_aria2() # Install aria2c
mount_drive() # Mount Drive for cache
download_file("https://...", "/content/models") # Cache-first download
status = get_cache_status([url1, url2]) # Check what's cached
clear_cache() # Reclaim ~7 GBIn-process ComfyUI node loading and image generation.
from src.generator import load_models, generate_image
nodes, unet, clip, vae = load_models()
img, path = generate_image(nodes, unet, clip, vae, prompt="a cat")Output packaging, stats, and cleanup.
from src.exporter import zip_outputs, download_zip, cleanup_outputs, get_output_stats
stats = get_output_stats() # Count + size of outputs
zip_path = zip_outputs() # Zip all PNGs
if zip_path:
download_zip(zip_path) # Browser download
cleanup_outputs(keep_latest=5) # Keep last 5, delete rest|
|
|
|
|
|
|
|
|
|
|
|
Run these prompts in the notebook to generate your own showcase images!
|
|
|
|
|
|
|
|
💡 Tip: Use the same seed to reproduce exact results. Try different samplers (
res_multistep,dpmpp_2m) for varied output styles.
|
|
|
|
Do I need a GPU to use this?
Not locally. The notebook runs on Google Colab's free T4 GPU. Just open the notebook and run.
Can I use this locally?
Yes, but you'll need a GPU with 16GB+ VRAM and Python 3.10+. Install ComfyUI, clone this repo, and run the src/ modules directly.
Why FP8 instead of GGUF?
FP8 is faster and produces better quality. GGUF is used as a fallback in other pipelines when FP8 isn't supported. ZImagePro is optimized for FP8-first hardware.
Why 20 steps? Can I use fewer?
20 steps provides excellent quality with euler sampler. You can reduce to 10-15 for faster generation or increase to 30-50 for maximum detail. Z-Image Turbo converges quickly.
Can I use this commercially?
This project is licensed under MIT. You can use, modify, and distribute it freely. Check the individual model licenses for Z-Image.
| Problem | Cause | Solution |
|---|---|---|
CUDA out of memory |
Resolution too high | Lower resolution or reduce batch size |
Module not found: comfyui |
ComfyUI not cloned properly | Re-run Cell 1 |
No images in output |
Generation not started | Wait for Cell 2's "✅ Engine Online" message |
Download failed |
Network timeout or invalid URL | Check URL, re-run Cell 1 |
Colab disconnects |
Idle timeout or session limit | Stay active, or upgrade to Colab Pro |
ImportError: gdown |
gdown not installed | Run !pip install gdown in a cell |
FP8 not loading |
GPU doesn't support FP8 | Try a different Colab runtime (T4/A100) |
Low disk space |
Too many outputs or cache | Run Cell 4 (🧹 Cache & Cleanup) |
Cache not working |
Drive not mounted | Check Cell 1 output for Drive mount status |
Slow first run |
Normal — downloads ~7 GB | Models cache to Drive; next run is ~30s |
|
|
Contributions are welcome! Here's how you can help:
|
Found something broken? |
Have an idea for the notebook? |
Ready to contribute code? |
# Clone the repo
git clone https://github.com/Shineii86/ZImagePro.git
cd ZImagePro
# Install dependencies
pip install -r requirements.txt
# Import modules
from src.config import DEFAULTS
from src.downloader import ensure_aria2
from src.generator import load_models, generate_image
from src.exporter import zip_outputsThis project is licensed under the MIT License.
Free to use, modify, and distribute — see the LICENSE file for details.