FLUX.2-klein-4B 整合GGUF权重包

---
license: apache-2.0
---

模型说明

本仓库为整合版权重仓库,仅做文件归集、整合打包,无任何权重训练、微调、参数修改操作:

  • GGUF量化Transformer主干:来源于 unsloth/FLUX.2-klein-4B-GGUF 采用 Unsloth Dynamic 2.0 量化方案。

  • VAE、模型配置、原生配套资源:来源于官方基座 black-forest-labs/FLUX.2-klein-4B

原始来源链接

修改说明

本项目仅将两个上游仓库资源整合归集:将 Unsloth 量化的 GGUF Transformer 权重,与官方完整 VAE、模型配置文件合并为一体,方便本地diffusers GGUF 推理、。未修改权重参数、未微调、未重量化、未蒸馏

快速使用 / 推理示例

安装依赖

pip install torch sdnq diffusers huggingface-hub

完整可运行代码

import torch
from sdnq import SDNQConfig
from diffusers import Flux2KleinPipeline, Flux2Transformer2DModel, GGUFQuantizationConfig
from huggingface_hub import hf_hub_download

device = "cuda"
dtype = torch.bfloat16

gguf_path = hf_hub_download(
    repo_id="csssss/com2ai-klein-4b",
    filename="transformer/flux-2-klein-4b-Q8_0.gguf",
)

config_path = hf_hub_download(
    repo_id="csssss/com2ai-klein-4b",
    filename="transformer/config.json",
)

transformer = Flux2Transformer2DModel.from_single_file(
    gguf_path, 
    quantization_config=GGUFQuantizationConfig(compute_dtype=dtype),
    torch_dtype=dtype,
    config=config_path
)

pipe = Flux2KleinPipeline.from_pretrained(
    "csssss/com2ai-klein-4b",
    transformer=transformer,
    torch_dtype=dtype
)

pipe.enable_model_cpu_offload()

prompt = "A cat holding a sign that says hello world"
image = pipe(
    prompt=prompt,
    height=1024,
    width=1024,
    guidance_scale=1.0,
    num_inference_steps=4,
    generator=torch.Generator(device=device).manual_seed(0)
).images[0]

image.save("flux-klein.png")
print("✅ 图像生成成功,已保存为 flux-klein.png")
Downloads last month
180
GGUF
Model size
4B params
Architecture
flux
Hardware compatibility
Log In to add your hardware

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support