Upload folder using huggingface_hub
Browse files- LICENSE +55 -0
- README.md +149 -0
- qwen_image_2.1_nvfp4.safetensors +3 -0
- qwen_image_2.1_nvfp4_T2.safetensors +3 -0
- qwen_image_2.1_nvfp4_T3.safetensors +3 -0
LICENSE
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Qwen RESEARCH LICENSE AGREEMENT
|
| 2 |
+
|
| 3 |
+
Qwen RESEARCH LICENSE AGREEMENT Release Date: September 20, 2026
|
| 4 |
+
|
| 5 |
+
By clicking to agree or by using or distributing any portion or element of the Qwen Materials, you will be deemed to have recognized and accepted the content of this Agreement, which is effective immediately.
|
| 6 |
+
|
| 7 |
+
1. Definitions
|
| 8 |
+
a. This Qwen RESEARCH LICENSE AGREEMENT (this "Agreement") shall mean the terms and conditions for use, reproduction, distribution and modification of the Materials as defined by this Agreement.
|
| 9 |
+
b. "We" (or "Us") shall mean Hangzhou Tongyi Laboratory Technology Co., Ltd.
|
| 10 |
+
c. "You" (or "Your") shall mean a natural person or legal entity exercising the rights granted by this Agreement and/or using the Materials for any purpose and in any field of use.
|
| 11 |
+
d. "Third Parties" shall mean individuals or legal entities that are not under common control with us or you.
|
| 12 |
+
e. "Qwen" shall mean the large language models, diffusion models, and software and algorithms, consisting of trained model weights, parameters (including optimizer states), machine-learning model code, inference-enabling code, training-enabling code, fine-tuning enabling code and other elements of the foregoing distributed by us.
|
| 13 |
+
f. "Materials" shall mean, collectively, our proprietary Qwen and Documentation (and any portion thereof) made available under this Agreement.
|
| 14 |
+
g. "Source" form shall mean the preferred form for making modifications, including but not limited to model source code, documentation source, and configuration files.
|
| 15 |
+
h. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
| 16 |
+
i. "Non-Commercial" shall mean for research or evaluation purposes only.
|
| 17 |
+
|
| 18 |
+
2. Grant of Rights
|
| 19 |
+
a. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under our intellectual property or other rights owned by us embodied in the Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the Materials FOR NON-COMMERCIAL PURPOSES ONLY.
|
| 20 |
+
b. You shall not use the Materials for any commercial purpose without obtaining a separate commercial license from us. If you wish to use the Materials commercially, you shall request a license from us at model-business@notice.qwencloud.com.
|
| 21 |
+
|
| 22 |
+
3. Redistribution
|
| 23 |
+
Subject to Section 2 (Grant of Rights), you may distribute copies or make the Materials, or derivative works thereof, available as part of a product or service that contains any of them, with or without modifications, and in Source or Object form, provided that you meet the following conditions:
|
| 24 |
+
a. You shall give any other recipients of the Materials or derivative works a copy of this Agreement;
|
| 25 |
+
b. You shall cause any modified files to carry prominent notices stating that you changed the files;
|
| 26 |
+
c. You shall retain in all copies of the Materials that you distribute the following attribution notices within a "Notice" text file distributed as a part of such copies: "Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) 2026 Hangzhou Tongyi Laboratory Technology Co., Ltd. All Rights Reserved."; and
|
| 27 |
+
d. You may add your own copyright statement to your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of your modifications, or for any such derivative works as a whole, provided your use, reproduction, and distribution of the work otherwise complies with the terms and conditions of this Agreement.
|
| 28 |
+
|
| 29 |
+
4. Rules of use
|
| 30 |
+
a. The Materials may be subject to export controls or restrictions in China, the United States or other countries or regions. You shall comply with applicable laws and regulations in your use of the Materials.
|
| 31 |
+
b. If you use the Materials or any outputs or results therefrom to create, train, fine-tune, or improve an AI model that is distributed or made available, you shall prominently display βBuilt with Qwenβ or βImproved using Qwenβ in the related product documentation.
|
| 32 |
+
c. You shall not use "Qwen" as the primary name or identifier of any derivative works or products; reasonable descriptive use (e.g., "fine-tuned from Qwen Image") is permitted.
|
| 33 |
+
|
| 34 |
+
5. Intellectual Property
|
| 35 |
+
a. We retain ownership of all intellectual property rights in and to the Materials and derivatives made by or for us. Conditioned upon compliance with the terms and conditions of this Agreement, with respect to any derivative works and modifications of the Materials that are made by you, you are and will be the owner of such derivative works and modifications.
|
| 36 |
+
b. No trademark license is granted to use the trade names, trademarks, service marks, or product names of us, except as required to fulfill notice requirements under this Agreement or as required for reasonable and customary use in describing and redistributing the Materials.
|
| 37 |
+
c. If you commence a lawsuit or other proceedings (including a cross-claim or counterclaim in a lawsuit) against us or any entity alleging that the Materials or any output therefrom, or any part of the foregoing, infringe any intellectual property or other right owned or licensable by you, then all licenses granted to you under this Agreement shall terminate as of the date such lawsuit or other proceeding is commenced or brought.
|
| 38 |
+
|
| 39 |
+
6. Disclaimer of Warranty and Limitation of Liability
|
| 40 |
+
a. We are not obligated to support, update, provide training for, or develop any further version of the Qwen Materials or to grant any license thereto.
|
| 41 |
+
b. THE MATERIALS ARE PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. WE MAKE NO WARRANTY AND ASSUME NO RESPONSIBILITY FOR THE SAFETY OR STABILITY OF THE MATERIALS AND ANY OUTPUT THEREFROM.
|
| 42 |
+
c. IN NO EVENT SHALL WE BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE MATERIALS OR ANY OUTPUT OF IT, NO MATTER HOW ITβS CAUSED.
|
| 43 |
+
d. You will defend, indemnify and hold harmless us from and against any claim by any third party arising out of or related to your use or distribution of the Materials.
|
| 44 |
+
|
| 45 |
+
7. Survival and Termination.
|
| 46 |
+
a. The term of this Agreement shall commence upon your acceptance of this Agreement or access to the Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein.
|
| 47 |
+
b. We may terminate this Agreement if you breach any of the terms or conditions of this Agreement. Upon termination of this Agreement, you must delete and cease use of the Materials. Sections 6 and 8 shall survive the termination of this Agreement.
|
| 48 |
+
|
| 49 |
+
8. Governing Law and Jurisdiction.
|
| 50 |
+
a. This Agreement and any dispute arising out of or relating to it will be governed by the laws of China, without regard to conflict of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement.
|
| 51 |
+
b. The People's Courts in Hangzhou City shall have exclusive jurisdiction over any dispute arising out of this Agreement.
|
| 52 |
+
|
| 53 |
+
9. Other Terms and Conditions.
|
| 54 |
+
a. Any arrangements, understandings, or agreements regarding the Material not stated herein are separate from and independent of the terms and conditions of this Agreement. You shall request a separate license from us, if you use the Materials in ways not expressly agreed to in this Agreement.
|
| 55 |
+
b. We shall not be bound by any additional or different terms or conditions communicated by you unless expressly agreed.
|
README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: qwen-research
|
| 4 |
+
license_link: LICENSE
|
| 5 |
+
base_model:
|
| 6 |
+
- Qwen/Qwen-Image-2.1
|
| 7 |
+
tags:
|
| 8 |
+
- quantized
|
| 9 |
+
- nvfp4
|
| 10 |
+
- comfyui
|
| 11 |
+
- qwen-image
|
| 12 |
+
- text-to-image
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Qwen-Image-2.1 DiT β NVFP4 (ComfyUI)
|
| 16 |
+
|
| 17 |
+
> β οΈ **ComfyUI format only.** These files use ComfyUI's native quantized-checkpoint
|
| 18 |
+
> layout (`comfy_quant` tensors + `_quantization_metadata`). They will **not** load
|
| 19 |
+
> in `diffusers`, and they need a ComfyUI build with `QwenImage21` support
|
| 20 |
+
> (merged after 2026-09-14). If you want the model for `diffusers`, use the
|
| 21 |
+
> [official bf16 release](https://huggingface.co/Qwen/Qwen-Image-2.1).
|
| 22 |
+
|
| 23 |
+
> **Not affiliated with, or endorsed by, Alibaba / Qwen.** Community derivative of
|
| 24 |
+
> [`Qwen/Qwen-Image-2.1`](https://huggingface.co/Qwen/Qwen-Image-2.1), redistributed
|
| 25 |
+
> under the **Qwen Research License** (copy included as `LICENSE`, per Β§3.a).
|
| 26 |
+
> **Non-commercial use only** (Β§1.i / Β§2.a); commercial use needs a separate licence
|
| 27 |
+
> from Qwen (`model-business@notice.qwencloud.com`, Β§2.b).
|
| 28 |
+
|
| 29 |
+
NVFP4 quantizations of the **diffusion transformer**. Comfy-Org ships `bf16` and
|
| 30 |
+
`int8_convrot`; **there is no official NVFP4 build**, so these are new.
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## Pick a file
|
| 35 |
+
|
| 36 |
+
| File | Size | Start here if⦠|
|
| 37 |
+
|---|---:|---|
|
| 38 |
+
| **`qwen_image_2.1_nvfp4.safetensors`** | **3.91 GB** | **you just want the smallest thing that works β this is the default** |
|
| 39 |
+
| `qwen_image_2.1_nvfp4_T2.safetensors` | 4.29 GB | you see artefacts on hard material and want a little more headroom |
|
| 40 |
+
| `qwen_image_2.1_nvfp4_T3.safetensors` | 4.67 GB | you want the most conservative option in the set |
|
| 41 |
+
|
| 42 |
+
Source is 13.25 GB bf16, so these are **29.5 % / 32.4 % / 35.2 %** of the original.
|
| 43 |
+
|
| 44 |
+
### What actually differs between them
|
| 45 |
+
|
| 46 |
+
The model has **32 transformer blocks**, each with 6 quantizable layers
|
| 47 |
+
(`attn.to_q/k/v/out.0`, `img_mlp.gate_up`, `img_mlp.out`) = 192 layers total.
|
| 48 |
+
The only axis that changes between tiers is **how many blocks at the head and tail
|
| 49 |
+
are kept at 8-bit instead of 4-bit**:
|
| 50 |
+
|
| 51 |
+
| | 4-bit NVFP4 (group 16) | 8-bit MXFP8 (group 32) | bf16 |
|
| 52 |
+
|---|---|---|---|
|
| 53 |
+
| **T1** (3.91 GB) | all 192 layers | β | 73 tensors |
|
| 54 |
+
| **T2** (4.29 GB) | 168 layers | 24 layers β blocks **0, 1, 30, 31** | 73 tensors |
|
| 55 |
+
| **T3** (4.67 GB) | 144 layers | 48 layers β blocks **0β3, 28β31** | 73 tensors |
|
| 56 |
+
|
| 57 |
+
The bf16 protection set is **identical in all three** β the tiers differ only in
|
| 58 |
+
that 4-bit β 8-bit trade at the ends of the stack.
|
| 59 |
+
|
| 60 |
+
### Does the extra size buy anything?
|
| 61 |
+
|
| 62 |
+
On a like-for-like test β same seed, same prompt, same text encoder β the three
|
| 63 |
+
tiers produced near-identical images: **mean per-pixel difference of 3β4 out of
|
| 64 |
+
255**. The extra 0.4β0.8 GB did not show a visible benefit there.
|
| 65 |
+
|
| 66 |
+
That was one prompt and one seed, so treat it as a starting point rather than a
|
| 67 |
+
verdict. Faces, small text and dense texture are the places where a difference
|
| 68 |
+
would show up first, so if you work on those, T2/T3 are worth a try.
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
## What is protected, and why
|
| 73 |
+
|
| 74 |
+
| Layers | Count | Precision |
|
| 75 |
+
|---|---:|---|
|
| 76 |
+
| `attn.to_q/k/v/out`, `img_mlp.gate_up/out` | 192 | NVFP4, or MXFP8 in T2/T3 |
|
| 77 |
+
| `img_in`, `txt_in.in_layer/out_layer` | 3 | **bf16** |
|
| 78 |
+
| `time_text_embed.timestep_embedder.linear_1/2` | 2 | **bf16** |
|
| 79 |
+
| `modulation.1` | 1 | **bf16** |
|
| 80 |
+
| `norm_out.linear`, `proj_out` | 2 | **bf16** |
|
| 81 |
+
| norms / biases (non-2-D) | 65 | bf16 |
|
| 82 |
+
|
| 83 |
+
98.1 % of parameters are quantized; the protected 1.9 % costs only ~240 MB.
|
| 84 |
+
|
| 85 |
+
**Why the timestep path stays bf16.** A DiT's `time_text_embed` and modulation decide
|
| 86 |
+
*how far each denoising step moves*. Measurements on a distilled model in this family
|
| 87 |
+
showed that when timestep conditioning is rewritten, the model stops working outside
|
| 88 |
+
the exact schedule it was trained for. Keeping that path in bf16 costs almost nothing
|
| 89 |
+
and removes a whole class of risk.
|
| 90 |
+
|
| 91 |
+
Every 2-D weight in this model has `in_features` divisible by 16, so **no padding is
|
| 92 |
+
needed anywhere** β the quantization is clean.
|
| 93 |
+
|
| 94 |
+
## Audit
|
| 95 |
+
|
| 96 |
+
| Check | Result |
|
| 97 |
+
|---|---|
|
| 98 |
+
| Metadata | `format_version 1.0`, 192 layers declared |
|
| 99 |
+
| Tensor bookkeeping | 0 missing, 0 extra; `comfy_quant` matches metadata for every layer |
|
| 100 |
+
| NVFP4 round-trip error | median **9.44 %**, max 9.49 % (24-layer sample) |
|
| 101 |
+
| MXFP8 round-trip error | median **2.65 %** β 3.6Γ tighter than NVFP4, as the bit budget predicts |
|
| 102 |
+
| Protected layers | 40/40 sampled are **byte-identical** to the bf16 source |
|
| 103 |
+
| Loads in ComfyUI | β
all three, detected as `QwenImage21` |
|
| 104 |
+
| End-to-end | β
1024Γ1024, 25 steps, **~20β22 s** on a GB10 |
|
| 105 |
+
|
| 106 |
+
The MXFP8 number matters: had the 8-bit path been written wrong, it would have landed
|
| 107 |
+
at or above the 4-bit error. It didn't.
|
| 108 |
+
|
| 109 |
+
## Usage
|
| 110 |
+
|
| 111 |
+
Place in `ComfyUI/models/diffusion_models/`, then use the official
|
| 112 |
+
[Qwen-Image-2.1 text-to-image workflow](https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_qwen_image_2_1_t2i.json):
|
| 113 |
+
|
| 114 |
+
```
|
| 115 |
+
UNETLoader β (this file)
|
| 116 |
+
CLIPLoader β qwen3vl_8b_*, type: qwen_image
|
| 117 |
+
TextEncodeQwenImage21
|
| 118 |
+
VAELoader β qwen_image_2.1_vae_bf16.safetensors
|
| 119 |
+
KSampler β 25 steps, cfg 1.0, euler, simple
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
Older ComfyUI builds report `UNSUPPORTED DIFFUSION MODEL` for Qwen-Image-2.1 in
|
| 123 |
+
general β **including the official bf16 files** β so if you see that, update ComfyUI
|
| 124 |
+
rather than suspecting these weights.
|
| 125 |
+
|
| 126 |
+
## Pitfall worth knowing (T2/T3)
|
| 127 |
+
|
| 128 |
+
`TensorCoreMXFP8Layout.quantize()` returns its scale as `float8_e8m0`, which
|
| 129 |
+
ComfyUI's safetensors loader cannot parse β `KeyError: 'F8_E8M0'`, and the file simply
|
| 130 |
+
refuses to load. The official checkpoints store that bit pattern as `uint8` and
|
| 131 |
+
reinterpret it at load time; these files do the same.
|
| 132 |
+
|
| 133 |
+
The all-NVFP4 tier never touches that code path, so **a bug in the MXFP8 route stays
|
| 134 |
+
invisible until you test T2/T3 specifically** β verifying T1 and assuming the rest
|
| 135 |
+
follow is exactly how it gets missed.
|
| 136 |
+
|
| 137 |
+
## Text encoder
|
| 138 |
+
|
| 139 |
+
The other half of the pipeline, with refusal behaviour ablated
|
| 140 |
+
(5/100 refusals @ KL 0.0220):
|
| 141 |
+
|
| 142 |
+
| Repo | Format | Runtime |
|
| 143 |
+
|---|---|---|
|
| 144 |
+
| [`β¦-Text-Encoder-Heretic`](https://huggingface.co/pottokao/Qwen-Image-2.1-Text-Encoder-Heretic) | bf16, 16.33 GB | `transformers` / any |
|
| 145 |
+
| [`β¦-Heretic-NVFP4`](https://huggingface.co/pottokao/Qwen-Image-2.1-Text-Encoder-Heretic-NVFP4) | NVFP4, 5.87 GB | **ComfyUI** |
|
| 146 |
+
| [`β¦-Heretic-W4A8`](https://huggingface.co/pottokao/Qwen-Image-2.1-Text-Encoder-Heretic-W4A8) | W4A8 INT8, 5.88 GB | **ComfyUI** |
|
| 147 |
+
| [`β¦-Heretic-GGUF`](https://huggingface.co/pottokao/Qwen-Image-2.1-Text-Encoder-Heretic-GGUF) | GGUF Q4_K_M + mmproj, 5.76 GB | **llama.cpp / Mac** |
|
| 148 |
+
|
| 149 |
+
This DiT + the NVFP4 text encoder is a complete **~9.8 GB** pipeline.
|
qwen_image_2.1_nvfp4.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c260c7286505f86ded8500664a2fde8522943c6f0bde78ab33ceba85ba50a68
|
| 3 |
+
size 4197590904
|
qwen_image_2.1_nvfp4_T2.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d0534357e7a64add83538f9a5434e851a5f09d82414dcb6ffca84de0a978a23a
|
| 3 |
+
size 4606533160
|
qwen_image_2.1_nvfp4_T3.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cbe2e6e2ae285bfb7e69270b09d0121425afddc191a4b669bffed68a509b0380
|
| 3 |
+
size 5015475376
|