ixim commited on
Commit
17dabb4
·
verified ·
1 Parent(s): c84bbf4

Update README

Browse files
.gitattributes CHANGED
@@ -44,3 +44,7 @@ zimage_quanto_bench_results/images/int8/portrait_01_seed46.png filter=lfs diff=l
44
  zimage_quanto_bench_results/images/int8/portrait_02_seed123.png filter=lfs diff=lfs merge=lfs -text
45
  zimage_quanto_bench_results/images/int8/scene_01_seed777.png filter=lfs diff=lfs merge=lfs -text
46
  tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
44
  zimage_quanto_bench_results/images/int8/portrait_02_seed123.png filter=lfs diff=lfs merge=lfs -text
45
  zimage_quanto_bench_results/images/int8/scene_01_seed777.png filter=lfs diff=lfs merge=lfs -text
46
  tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
47
+ zimage_quanto_bench_results/images/baseline/landscape_01_seed123.png filter=lfs diff=lfs merge=lfs -text
48
+ zimage_quanto_bench_results/images/baseline/portrait_02_seed111.png filter=lfs diff=lfs merge=lfs -text
49
+ zimage_quanto_bench_results/images/int8/landscape_01_seed123.png filter=lfs diff=lfs merge=lfs -text
50
+ zimage_quanto_bench_results/images/int8/portrait_02_seed111.png filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -33,6 +33,12 @@ This repository provides an INT8-quantized variant of [Tongyi-MAI/Z-Image](https
33
  - **Pipeline**: `diffusers.ZImagePipeline`
34
  - **Negative prompt support**: Yes (same pipeline API as the base model)
35
 
 
 
 
 
 
 
36
  ## Files
37
 
38
  Key files in this repository:
@@ -61,14 +67,11 @@ python -m pip install --upgrade pip
61
  # PyTorch (NVIDIA CUDA, example)
62
  pip install torch --index-url https://download.pytorch.org/whl/cu128
63
 
64
- # PyTorch (macOS / CPU-only example)
65
  # pip install torch
66
 
67
  # Inference dependencies
68
  pip install diffusers transformers accelerate safetensors sentencepiece optimum-quanto pillow
69
-
70
- # Recommended minimum versions (helps avoid backend compatibility issues)
71
- pip install -U "torch>=2.4" "diffusers>=0.36.0" "accelerate>=0.33"
72
  ```
73
 
74
  ## Quick Start (Diffusers)
@@ -77,6 +80,7 @@ This repo already stores quantized weights, so you do **not** need to re-run qua
77
 
78
  ```python
79
  import torch
 
80
  from diffusers import ZImagePipeline
81
 
82
  model_id = "ixim/Z-Image-INT8"
@@ -89,7 +93,7 @@ elif torch.backends.mps.is_available():
89
  device = "mps"
90
  dtype = torch.float16
91
  else:
92
- # Intel Mac / CPU-only
93
  device = "cpu"
94
  dtype = torch.float32
95
 
@@ -105,7 +109,7 @@ else:
105
  pipe = pipe.to(device)
106
 
107
  prompt = "A cinematic portrait of a young woman, soft lighting, high detail"
108
- negative_prompt = "blurry, low quality, distorted face, extra limbs, artifacts"
109
  # Use CPU generator for best cross-device compatibility (cpu/mps/cuda)
110
  generator = torch.Generator(device="cpu").manual_seed(42)
111
 
@@ -125,9 +129,8 @@ print("Saved: zimage_int8_sample.png")
125
 
126
  ## macOS Notes & Troubleshooting
127
 
128
- - `AttributeError: module 'torch' has no attribute 'xpu'` is usually a backend/version compatibility issue in the local environment, not a model issue.
129
- - Fix it by upgrading to recent versions:
130
- - `pip install -U "torch>=2.4" "diffusers>=0.36.0" "accelerate>=0.33"`
131
  - On Apple Silicon, warnings like `CUDA not available` and `Disabling autocast` are expected in non-CUDA execution paths.
132
  - Slow speed on Mac is expected compared with high-end NVIDIA GPUs. To improve speed on Apple Silicon:
133
  - Ensure the script uses `mps` (as in the example above), not `cpu`.
@@ -154,15 +157,15 @@ These two images are generated with this quantized model:
154
  Test environment:
155
  - GPU: NVIDIA GeForce RTX 5090
156
  - Framework: PyTorch 2.10.0+cu130
157
- - Inference setting: 1024×1024, 28 steps, guidance=4.0, CPU offload enabled
158
- - Cases: 4 prompts (`portrait_01`, `portrait_02`, `scene_01`, `night_01`)
159
 
160
  ### Aggregate Comparison (Baseline vs INT8)
161
 
162
  | Metric | Baseline | INT8 | Delta |
163
  |---|---:|---:|---:|
164
- | Avg elapsed / image (s) | 51.7766 | 39.5662 | **-23.6%** |
165
- | Avg sec / step | 1.8492 | 1.4131 | **-23.6%** |
166
  | Avg peak CUDA alloc (GB) | 12.5195 | 7.7470 | **-38.1%** |
167
 
168
 
@@ -172,10 +175,11 @@ Test environment:
172
 
173
  | Case | Baseline (s) | INT8 (s) | Speedup |
174
  |---|---:|---:|---:|
175
- | portrait_01 | 99.9223 | 60.6768 | 1.65x |
176
- | portrait_02 | 37.4116 | 32.8863 | 1.14x |
177
- | scene_01 | 34.9946 | 32.2035 | 1.09x |
178
- | night_01 | 34.7780 | 32.4981 | 1.07x |
 
179
 
180
  ## Visual Comparison (Baseline vs INT8)
181
 
@@ -184,7 +188,8 @@ Left: Baseline. Right: INT8. (Same prompt/seed/steps.)
184
  | Case | Base | INT8 |
185
  |---|---|---|
186
  | portrait_01 | ![](zimage_quanto_bench_results/images/baseline/portrait_01_seed46.png) | ![](zimage_quanto_bench_results/images/int8/portrait_01_seed46.png) |
187
- | portrait_02 | ![](zimage_quanto_bench_results/images/baseline/portrait_02_seed123.png) | ![](zimage_quanto_bench_results/images/int8/portrait_02_seed123.png) |
 
188
  | scene_01 | ![](zimage_quanto_bench_results/images/baseline/scene_01_seed777.png) | ![](zimage_quanto_bench_results/images/int8/scene_01_seed777.png) |
189
  | night_01 | ![](zimage_quanto_bench_results/images/baseline/night_01_seed2026.png) | ![](zimage_quanto_bench_results/images/int8/night_01_seed2026.png) |
190
 
 
33
  - **Pipeline**: `diffusers.ZImagePipeline`
34
  - **Negative prompt support**: Yes (same pipeline API as the base model)
35
 
36
+ ## Platform Support
37
+
38
+ - ✅ Supported: Linux/Windows with NVIDIA CUDA
39
+ - ⚠️ Limited support: macOS Apple Silicon (MPS, usually much slower than CUDA)
40
+ - ❌ Not supported: macOS Intel
41
+
42
  ## Files
43
 
44
  Key files in this repository:
 
67
  # PyTorch (NVIDIA CUDA, example)
68
  pip install torch --index-url https://download.pytorch.org/whl/cu128
69
 
70
+ # PyTorch (macOS Apple Silicon, MPS)
71
  # pip install torch
72
 
73
  # Inference dependencies
74
  pip install diffusers transformers accelerate safetensors sentencepiece optimum-quanto pillow
 
 
 
75
  ```
76
 
77
  ## Quick Start (Diffusers)
 
80
 
81
  ```python
82
  import torch
83
+
84
  from diffusers import ZImagePipeline
85
 
86
  model_id = "ixim/Z-Image-INT8"
 
93
  device = "mps"
94
  dtype = torch.float16
95
  else:
96
+ # CPU fallback (functional but very slow for this model)
97
  device = "cpu"
98
  dtype = torch.float32
99
 
 
109
  pipe = pipe.to(device)
110
 
111
  prompt = "A cinematic portrait of a young woman, soft lighting, high detail"
112
+ negative_prompt = "blurry, sad, low quality, distorted face, extra limbs, artifacts"
113
  # Use CPU generator for best cross-device compatibility (cpu/mps/cuda)
114
  generator = torch.Generator(device="cpu").manual_seed(42)
115
 
 
129
 
130
  ## macOS Notes & Troubleshooting
131
 
132
+ - macOS Intel is no longer supported for this model in this repository.
133
+ - If you need macOS inference, use Apple Silicon (`mps`) only.
 
134
  - On Apple Silicon, warnings like `CUDA not available` and `Disabling autocast` are expected in non-CUDA execution paths.
135
  - Slow speed on Mac is expected compared with high-end NVIDIA GPUs. To improve speed on Apple Silicon:
136
  - Ensure the script uses `mps` (as in the example above), not `cpu`.
 
157
  Test environment:
158
  - GPU: NVIDIA GeForce RTX 5090
159
  - Framework: PyTorch 2.10.0+cu130
160
+ - Inference setting: 1024×1024, 50 steps, guidance=4.0, CPU offload enabled
161
+ - Cases: 5 prompts (`portrait_01`, `portrait_02`, `landscape_01`, `scene_01`, `night_01`)
162
 
163
  ### Aggregate Comparison (Baseline vs INT8)
164
 
165
  | Metric | Baseline | INT8 | Delta |
166
  |---|---:|---:|---:|
167
+ | Avg elapsed / image (s) | 49.0282 | 46.7867 | **-4.6%** |
168
+ | Avg sec / step | 0.980564 | 0.935733 | **-4.6%** |
169
  | Avg peak CUDA alloc (GB) | 12.5195 | 7.7470 | **-38.1%** |
170
 
171
 
 
175
 
176
  | Case | Baseline (s) | INT8 (s) | Speedup |
177
  |---|---:|---:|---:|
178
+ | portrait_01 | 56.9943 | 50.1124 | 1.14x |
179
+ | portrait_02 | 50.3810 | 46.0371 | 1.09x |
180
+ | landscape_01 | 46.0286 | 46.0192 | 1.00x |
181
+ | scene_01 | 45.9097 | 45.8291 | 1.00x |
182
+ | night_01 | 45.8275 | 45.9356 | 1.00x |
183
 
184
  ## Visual Comparison (Baseline vs INT8)
185
 
 
188
  | Case | Base | INT8 |
189
  |---|---|---|
190
  | portrait_01 | ![](zimage_quanto_bench_results/images/baseline/portrait_01_seed46.png) | ![](zimage_quanto_bench_results/images/int8/portrait_01_seed46.png) |
191
+ | portrait_02 | ![](zimage_quanto_bench_results/images/baseline/portrait_02_seed111.png) | ![](zimage_quanto_bench_results/images/int8/portrait_02_seed111.png) |
192
+ | landscape_01 | ![](zimage_quanto_bench_results/images/baseline/landscape_01_seed123.png) | ![](zimage_quanto_bench_results/images/int8/landscape_01_seed123.png) |
193
  | scene_01 | ![](zimage_quanto_bench_results/images/baseline/scene_01_seed777.png) | ![](zimage_quanto_bench_results/images/int8/scene_01_seed777.png) |
194
  | night_01 | ![](zimage_quanto_bench_results/images/baseline/night_01_seed2026.png) | ![](zimage_quanto_bench_results/images/int8/night_01_seed2026.png) |
195
 
test_outputs/cn_scene_1024x1024.png CHANGED

Git LFS Details

  • SHA256: a359367321ca48cbe151911ac45fc2900e52936797a74b8c272198baf52473da
  • Pointer size: 132 Bytes
  • Size of remote file: 1.54 MB

Git LFS Details

  • SHA256: ae8d7c6275ef3329303253643093f849c0a7591cea86a3c6e333fd56ea3c7f4d
  • Pointer size: 132 Bytes
  • Size of remote file: 1.57 MB
test_outputs/en_portrait_1024x1024.png CHANGED

Git LFS Details

  • SHA256: 50cb51825502959b44dbccfdd221ff5a4aea8cb086013001cf254c6d6847ab80
  • Pointer size: 132 Bytes
  • Size of remote file: 1.43 MB

Git LFS Details

  • SHA256: c89cab21bdebae13df8237d790d883fdafacd624b2331c63e46e4258037267da
  • Pointer size: 132 Bytes
  • Size of remote file: 1.45 MB
zimage_quanto_bench_results/images/baseline/landscape_01_seed123.png ADDED

Git LFS Details

  • SHA256: 0fed1e7002a26c4ab57be521a63d6668d205a45c972332bb060ddcebfd834ad5
  • Pointer size: 132 Bytes
  • Size of remote file: 1.64 MB
zimage_quanto_bench_results/images/baseline/night_01_seed2026.png CHANGED

Git LFS Details

  • SHA256: ad334590f6eb8becf12f317053f8077f175f572776029f48c9efbefcaabfcc42
  • Pointer size: 132 Bytes
  • Size of remote file: 1.93 MB

Git LFS Details

  • SHA256: 0c8223809a905ab20eb334df4ded8806a76f487a6014b6314b3f9de71c7e0be6
  • Pointer size: 132 Bytes
  • Size of remote file: 2.02 MB
zimage_quanto_bench_results/images/baseline/portrait_01_seed46.png CHANGED

Git LFS Details

  • SHA256: 53dfbcad60581719889be4fd936f2aef3f4e1e15b131130a4f75c2d1a456f19e
  • Pointer size: 132 Bytes
  • Size of remote file: 1.16 MB

Git LFS Details

  • SHA256: 1b562c430f7c8d77e2b6865b7e8ebb4d324d9e62076fe71fe06a5accac737c61
  • Pointer size: 132 Bytes
  • Size of remote file: 1.18 MB
zimage_quanto_bench_results/images/baseline/portrait_02_seed111.png ADDED

Git LFS Details

  • SHA256: 5ac058e5c5eedc582f5816dab41240729b19a95b9564746696b1fc94cc0e10a7
  • Pointer size: 132 Bytes
  • Size of remote file: 1.35 MB
zimage_quanto_bench_results/images/baseline/scene_01_seed777.png CHANGED

Git LFS Details

  • SHA256: 5cbfe1a9491e4c0ca80e4edbda385375694589ac2c220d93c5593616097f4aca
  • Pointer size: 132 Bytes
  • Size of remote file: 1.42 MB

Git LFS Details

  • SHA256: a5df3752117c1ac963837b832de06d01f2a80e274fec9ac5da87914a9f0f0a34
  • Pointer size: 132 Bytes
  • Size of remote file: 1.41 MB
zimage_quanto_bench_results/images/int8/landscape_01_seed123.png ADDED

Git LFS Details

  • SHA256: 6b9c6cfdd61661dcae6469c6d04b0ada8c39bb88bfd5d7213a2a69345a6d8084
  • Pointer size: 132 Bytes
  • Size of remote file: 1.56 MB
zimage_quanto_bench_results/images/int8/night_01_seed2026.png CHANGED

Git LFS Details

  • SHA256: 70f8345f4b9ea8453b4b5c508a96a9c2381c121ca2683f26d821bb1b547abab6
  • Pointer size: 132 Bytes
  • Size of remote file: 1.8 MB

Git LFS Details

  • SHA256: 9cc695cc82b8a32d422937a18a4d014289b72e4641ca90c6651c3e0ed9d07e08
  • Pointer size: 132 Bytes
  • Size of remote file: 1.85 MB
zimage_quanto_bench_results/images/int8/portrait_01_seed46.png CHANGED

Git LFS Details

  • SHA256: 7b524b55315216f017f24091b05bf2ede3e0fb14deb9759581f27a998c2024f5
  • Pointer size: 132 Bytes
  • Size of remote file: 1.04 MB

Git LFS Details

  • SHA256: b2a49c2482eaaf18ad830f33beb17ed7056b4d12173cb4ec800c4b807f0a49b6
  • Pointer size: 132 Bytes
  • Size of remote file: 1.05 MB
zimage_quanto_bench_results/images/int8/portrait_02_seed111.png ADDED

Git LFS Details

  • SHA256: 2959c0f50b906c912e960e578ae0a3e566a2596411bbca85f1db7c28c413e047
  • Pointer size: 132 Bytes
  • Size of remote file: 1.21 MB
zimage_quanto_bench_results/images/int8/scene_01_seed777.png CHANGED

Git LFS Details

  • SHA256: d11ea2b76e22d8f7a871d41e54327e1889c981872a8e3ef72628b7225492a50c
  • Pointer size: 132 Bytes
  • Size of remote file: 1.34 MB

Git LFS Details

  • SHA256: 695b3c7d8b6ef53d748ab358936edb2954953a31d32d7abeef38614dca3d3a8e
  • Pointer size: 132 Bytes
  • Size of remote file: 1.35 MB