Instructions to use codeShare/Flux.2-Klein-4B-SDNQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use codeShare/Flux.2-Klein-4B-SDNQ-4bit 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-4B-SDNQ-4bit", 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
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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-4B/snapshots/e7b7dc27f91deacad38e78976d1f2b499d76a294/transformer",
|
| 5 |
+
"attention_head_dim": 128,
|
| 6 |
+
"axes_dims_rope": [
|
| 7 |
+
32,
|
| 8 |
+
32,
|
| 9 |
+
32,
|
| 10 |
+
32
|
| 11 |
+
],
|
| 12 |
+
"eps": 1e-06,
|
| 13 |
+
"guidance_embeds": false,
|
| 14 |
+
"in_channels": 128,
|
| 15 |
+
"joint_attention_dim": 7680,
|
| 16 |
+
"mlp_ratio": 3.0,
|
| 17 |
+
"num_attention_heads": 24,
|
| 18 |
+
"num_layers": 5,
|
| 19 |
+
"num_single_layers": 20,
|
| 20 |
+
"out_channels": null,
|
| 21 |
+
"patch_size": 1,
|
| 22 |
+
"quantization_config": {
|
| 23 |
+
"add_skip_keys": true,
|
| 24 |
+
"dequantize_fp32": true,
|
| 25 |
+
"dynamic_loss_threshold": null,
|
| 26 |
+
"group_size": 0,
|
| 27 |
+
"is_integer": true,
|
| 28 |
+
"is_training": false,
|
| 29 |
+
"modules_dtype_dict": {
|
| 30 |
+
"int8": [
|
| 31 |
+
"lm_head"
|
| 32 |
+
]
|
| 33 |
+
},
|
| 34 |
+
"modules_quant_config": {},
|
| 35 |
+
"modules_to_not_convert": [
|
| 36 |
+
"norm_out",
|
| 37 |
+
"context_embedder",
|
| 38 |
+
"time_guidance_embed",
|
| 39 |
+
"double_stream_modulation_img",
|
| 40 |
+
"x_embedder",
|
| 41 |
+
".proj_out",
|
| 42 |
+
"pos_embed",
|
| 43 |
+
"double_stream_modulation_txt",
|
| 44 |
+
"single_stream_modulation"
|
| 45 |
+
],
|
| 46 |
+
"non_blocking": false,
|
| 47 |
+
"quant_conv": false,
|
| 48 |
+
"quant_embedding": false,
|
| 49 |
+
"quant_method": "sdnq",
|
| 50 |
+
"quantization_device": "cuda",
|
| 51 |
+
"quantized_matmul_dtype": null,
|
| 52 |
+
"return_device": "cpu",
|
| 53 |
+
"sdnq_version": "0.1.8",
|
| 54 |
+
"svd_rank": 32,
|
| 55 |
+
"svd_steps": 8,
|
| 56 |
+
"use_dynamic_quantization": false,
|
| 57 |
+
"use_grad_ckpt": true,
|
| 58 |
+
"use_quantized_matmul": true,
|
| 59 |
+
"use_quantized_matmul_conv": false,
|
| 60 |
+
"use_static_quantization": true,
|
| 61 |
+
"use_stochastic_rounding": false,
|
| 62 |
+
"use_svd": false,
|
| 63 |
+
"weights_dtype": "uint4"
|
| 64 |
+
},
|
| 65 |
+
"rope_theta": 2000,
|
| 66 |
+
"timestep_guidance_channels": 256
|
| 67 |
+
}
|
transformer/diffusion_pytorch_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f9e01c4d8aff55955a040f2d5ad310e74adea599473f61f1ad3cb4aa7cbe6508
|
| 3 |
+
size 2690443984
|