Instructions to use codeShare/FLUX.2-klein-9b-SDNQ-2bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use codeShare/FLUX.2-klein-9b-SDNQ-2bit with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("codeShare/FLUX.2-klein-9b-SDNQ-2bit", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Upload transformer component
Browse files
transformer/config.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"_class_name": "Flux2Transformer2DModel",
|
| 3 |
-
"_diffusers_version": "0.
|
| 4 |
"_name_or_path": "/root/.cache/huggingface/hub/models--black-forest-labs--FLUX.2-klein-9B/snapshots/92196c8e11f7b6cf2b7493e037d8c5345c559216/transformer",
|
| 5 |
"attention_head_dim": 128,
|
| 6 |
"axes_dims_rope": [
|
|
@@ -22,29 +22,12 @@
|
|
| 22 |
"quantization_config": {
|
| 23 |
"add_skip_keys": true,
|
| 24 |
"dequantize_fp32": true,
|
| 25 |
-
"dynamic_loss_threshold": 0.
|
| 26 |
"group_size": 0,
|
| 27 |
"is_integer": true,
|
| 28 |
"is_training": false,
|
| 29 |
"modules_dtype_dict": {
|
| 30 |
-
"
|
| 31 |
-
"transformer_blocks.0.attn.to_q.weight",
|
| 32 |
-
"transformer_blocks.0.attn.to_k.weight"
|
| 33 |
-
],
|
| 34 |
-
"int5": [
|
| 35 |
-
"single_transformer_blocks.0.attn.to_qkv_mlp_proj.weight",
|
| 36 |
-
"single_transformer_blocks.1.attn.to_out.weight",
|
| 37 |
-
"single_transformer_blocks.2.attn.to_out.weight",
|
| 38 |
-
"single_transformer_blocks.4.attn.to_qkv_mlp_proj.weight",
|
| 39 |
-
"single_transformer_blocks.12.attn.to_qkv_mlp_proj.weight",
|
| 40 |
-
"single_transformer_blocks.17.attn.to_qkv_mlp_proj.weight",
|
| 41 |
-
"single_transformer_blocks.19.attn.to_qkv_mlp_proj.weight",
|
| 42 |
-
"single_transformer_blocks.20.attn.to_qkv_mlp_proj.weight",
|
| 43 |
-
"single_transformer_blocks.21.attn.to_qkv_mlp_proj.weight",
|
| 44 |
-
"single_transformer_blocks.22.attn.to_qkv_mlp_proj.weight",
|
| 45 |
-
"single_transformer_blocks.23.attn.to_qkv_mlp_proj.weight"
|
| 46 |
-
],
|
| 47 |
-
"uint4": [
|
| 48 |
"transformer_blocks.0.attn.to_v.weight",
|
| 49 |
"transformer_blocks.0.attn.to_out.0.weight",
|
| 50 |
"transformer_blocks.0.attn.add_q_proj.weight",
|
|
@@ -139,11 +122,15 @@
|
|
| 139 |
"transformer_blocks.7.ff.linear_out.weight",
|
| 140 |
"transformer_blocks.7.ff_context.linear_in.weight",
|
| 141 |
"transformer_blocks.7.ff_context.linear_out.weight",
|
|
|
|
| 142 |
"single_transformer_blocks.0.attn.to_out.weight",
|
| 143 |
"single_transformer_blocks.1.attn.to_qkv_mlp_proj.weight",
|
|
|
|
| 144 |
"single_transformer_blocks.2.attn.to_qkv_mlp_proj.weight",
|
|
|
|
| 145 |
"single_transformer_blocks.3.attn.to_qkv_mlp_proj.weight",
|
| 146 |
"single_transformer_blocks.3.attn.to_out.weight",
|
|
|
|
| 147 |
"single_transformer_blocks.4.attn.to_out.weight",
|
| 148 |
"single_transformer_blocks.5.attn.to_qkv_mlp_proj.weight",
|
| 149 |
"single_transformer_blocks.5.attn.to_out.weight",
|
|
@@ -159,6 +146,7 @@
|
|
| 159 |
"single_transformer_blocks.10.attn.to_out.weight",
|
| 160 |
"single_transformer_blocks.11.attn.to_qkv_mlp_proj.weight",
|
| 161 |
"single_transformer_blocks.11.attn.to_out.weight",
|
|
|
|
| 162 |
"single_transformer_blocks.12.attn.to_out.weight",
|
| 163 |
"single_transformer_blocks.13.attn.to_qkv_mlp_proj.weight",
|
| 164 |
"single_transformer_blocks.13.attn.to_out.weight",
|
|
@@ -168,26 +156,36 @@
|
|
| 168 |
"single_transformer_blocks.15.attn.to_out.weight",
|
| 169 |
"single_transformer_blocks.16.attn.to_qkv_mlp_proj.weight",
|
| 170 |
"single_transformer_blocks.16.attn.to_out.weight",
|
|
|
|
| 171 |
"single_transformer_blocks.17.attn.to_out.weight",
|
| 172 |
"single_transformer_blocks.18.attn.to_qkv_mlp_proj.weight",
|
| 173 |
"single_transformer_blocks.18.attn.to_out.weight",
|
|
|
|
| 174 |
"single_transformer_blocks.19.attn.to_out.weight",
|
|
|
|
| 175 |
"single_transformer_blocks.20.attn.to_out.weight",
|
|
|
|
| 176 |
"single_transformer_blocks.21.attn.to_out.weight",
|
|
|
|
| 177 |
"single_transformer_blocks.22.attn.to_out.weight",
|
|
|
|
| 178 |
"single_transformer_blocks.23.attn.to_out.weight"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
]
|
| 180 |
},
|
| 181 |
"modules_quant_config": {},
|
| 182 |
"modules_to_not_convert": [
|
|
|
|
|
|
|
|
|
|
| 183 |
".proj_out",
|
| 184 |
"single_stream_modulation",
|
| 185 |
-
"double_stream_modulation_img",
|
| 186 |
-
"norm_out",
|
| 187 |
-
"x_embedder",
|
| 188 |
"context_embedder",
|
| 189 |
-
"
|
| 190 |
-
"
|
| 191 |
],
|
| 192 |
"non_blocking": false,
|
| 193 |
"quant_conv": false,
|
|
@@ -198,7 +196,7 @@
|
|
| 198 |
"return_device": "cpu",
|
| 199 |
"sdnq_version": "0.1.8",
|
| 200 |
"svd_rank": 32,
|
| 201 |
-
"svd_steps":
|
| 202 |
"use_dynamic_quantization": true,
|
| 203 |
"use_grad_ckpt": true,
|
| 204 |
"use_quantized_matmul": false,
|
|
|
|
| 1 |
{
|
| 2 |
"_class_name": "Flux2Transformer2DModel",
|
| 3 |
+
"_diffusers_version": "0.37.1",
|
| 4 |
"_name_or_path": "/root/.cache/huggingface/hub/models--black-forest-labs--FLUX.2-klein-9B/snapshots/92196c8e11f7b6cf2b7493e037d8c5345c559216/transformer",
|
| 5 |
"attention_head_dim": 128,
|
| 6 |
"axes_dims_rope": [
|
|
|
|
| 22 |
"quantization_config": {
|
| 23 |
"add_skip_keys": true,
|
| 24 |
"dequantize_fp32": true,
|
| 25 |
+
"dynamic_loss_threshold": 0.1,
|
| 26 |
"group_size": 0,
|
| 27 |
"is_integer": true,
|
| 28 |
"is_training": false,
|
| 29 |
"modules_dtype_dict": {
|
| 30 |
+
"int3": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
"transformer_blocks.0.attn.to_v.weight",
|
| 32 |
"transformer_blocks.0.attn.to_out.0.weight",
|
| 33 |
"transformer_blocks.0.attn.add_q_proj.weight",
|
|
|
|
| 122 |
"transformer_blocks.7.ff.linear_out.weight",
|
| 123 |
"transformer_blocks.7.ff_context.linear_in.weight",
|
| 124 |
"transformer_blocks.7.ff_context.linear_out.weight",
|
| 125 |
+
"single_transformer_blocks.0.attn.to_qkv_mlp_proj.weight",
|
| 126 |
"single_transformer_blocks.0.attn.to_out.weight",
|
| 127 |
"single_transformer_blocks.1.attn.to_qkv_mlp_proj.weight",
|
| 128 |
+
"single_transformer_blocks.1.attn.to_out.weight",
|
| 129 |
"single_transformer_blocks.2.attn.to_qkv_mlp_proj.weight",
|
| 130 |
+
"single_transformer_blocks.2.attn.to_out.weight",
|
| 131 |
"single_transformer_blocks.3.attn.to_qkv_mlp_proj.weight",
|
| 132 |
"single_transformer_blocks.3.attn.to_out.weight",
|
| 133 |
+
"single_transformer_blocks.4.attn.to_qkv_mlp_proj.weight",
|
| 134 |
"single_transformer_blocks.4.attn.to_out.weight",
|
| 135 |
"single_transformer_blocks.5.attn.to_qkv_mlp_proj.weight",
|
| 136 |
"single_transformer_blocks.5.attn.to_out.weight",
|
|
|
|
| 146 |
"single_transformer_blocks.10.attn.to_out.weight",
|
| 147 |
"single_transformer_blocks.11.attn.to_qkv_mlp_proj.weight",
|
| 148 |
"single_transformer_blocks.11.attn.to_out.weight",
|
| 149 |
+
"single_transformer_blocks.12.attn.to_qkv_mlp_proj.weight",
|
| 150 |
"single_transformer_blocks.12.attn.to_out.weight",
|
| 151 |
"single_transformer_blocks.13.attn.to_qkv_mlp_proj.weight",
|
| 152 |
"single_transformer_blocks.13.attn.to_out.weight",
|
|
|
|
| 156 |
"single_transformer_blocks.15.attn.to_out.weight",
|
| 157 |
"single_transformer_blocks.16.attn.to_qkv_mlp_proj.weight",
|
| 158 |
"single_transformer_blocks.16.attn.to_out.weight",
|
| 159 |
+
"single_transformer_blocks.17.attn.to_qkv_mlp_proj.weight",
|
| 160 |
"single_transformer_blocks.17.attn.to_out.weight",
|
| 161 |
"single_transformer_blocks.18.attn.to_qkv_mlp_proj.weight",
|
| 162 |
"single_transformer_blocks.18.attn.to_out.weight",
|
| 163 |
+
"single_transformer_blocks.19.attn.to_qkv_mlp_proj.weight",
|
| 164 |
"single_transformer_blocks.19.attn.to_out.weight",
|
| 165 |
+
"single_transformer_blocks.20.attn.to_qkv_mlp_proj.weight",
|
| 166 |
"single_transformer_blocks.20.attn.to_out.weight",
|
| 167 |
+
"single_transformer_blocks.21.attn.to_qkv_mlp_proj.weight",
|
| 168 |
"single_transformer_blocks.21.attn.to_out.weight",
|
| 169 |
+
"single_transformer_blocks.22.attn.to_qkv_mlp_proj.weight",
|
| 170 |
"single_transformer_blocks.22.attn.to_out.weight",
|
| 171 |
+
"single_transformer_blocks.23.attn.to_qkv_mlp_proj.weight",
|
| 172 |
"single_transformer_blocks.23.attn.to_out.weight"
|
| 173 |
+
],
|
| 174 |
+
"uint2": [
|
| 175 |
+
"transformer_blocks.0.attn.to_q.weight",
|
| 176 |
+
"transformer_blocks.0.attn.to_k.weight"
|
| 177 |
]
|
| 178 |
},
|
| 179 |
"modules_quant_config": {},
|
| 180 |
"modules_to_not_convert": [
|
| 181 |
+
"double_stream_modulation_txt",
|
| 182 |
+
"time_guidance_embed",
|
| 183 |
+
"x_embedder",
|
| 184 |
".proj_out",
|
| 185 |
"single_stream_modulation",
|
|
|
|
|
|
|
|
|
|
| 186 |
"context_embedder",
|
| 187 |
+
"norm_out",
|
| 188 |
+
"double_stream_modulation_img"
|
| 189 |
],
|
| 190 |
"non_blocking": false,
|
| 191 |
"quant_conv": false,
|
|
|
|
| 196 |
"return_device": "cpu",
|
| 197 |
"sdnq_version": "0.1.8",
|
| 198 |
"svd_rank": 32,
|
| 199 |
+
"svd_steps": 16,
|
| 200 |
"use_dynamic_quantization": true,
|
| 201 |
"use_grad_ckpt": true,
|
| 202 |
"use_quantized_matmul": false,
|
transformer/diffusion_pytorch_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e01ac8976ff915fb864ec7395cd0bd3b2d60a659c0ac933558a69b2dfb97a42e
|
| 3 |
+
size 4701916360
|