Downloads · 30 days
0
dushandz/FLUX.2-klein-4B-CoreAI
FLUX.2-klein-4B-CoreAI is a text-to-image model from dushandz. Use it when you need an image from a text prompt. It is set up for coreai. The card lists the license as apache-2.0.
Apple Core AI 格式的 FLUX.2 klein 4B, 可在 macOS 26 / iOS 26 及以上直接经 CoreAIDiffusion 加载运行。
Downloads · 30 days
0
Access
Public
Updated Sep 14, 2026
Repo size
4.3 GB
Likes
0
Public
Click a slice to open those files.
.mlirb4.3 GB · 100%
From the Hugging Face model README
Apple Core AI 格式的 FLUX.2 klein 4B,
可在 macOS 26 / iOS 26 及以上直接经 CoreAIDiffusion 加载运行。
原始权重由 Black Forest Labs 以 Apache License 2.0 发布。本仓库内的文件已被修改, 具体变更如下:
| 变更 | 说明 |
|---|---|
| 格式转换 | PyTorch safetensors → Core AI .aimodel(MLIR 字节码) |
| 量化 | float16 → int4,per-block 粒度,block_size=32 |
| 图追踪 | 经 torch.export 追踪为 8 个入口的 multi-function 资产 |
未对模型架构或训练权重的数值语义做任何人为调整,全部变更均由 Apple 官方导出工具产生。
| 项 | 值 |
|---|---|
| 源模型 | black-forest-labs/FLUX.2-klein-4B |
| 源 commit | e7b7dc27f91deacad38e78976d1f2b499d76a294 |
| 导出工具 | apple/coreai-models @ e282dbdd4339f16cac14da80fbcbd185d90dd12a |
| 转换器 | coreai-torch 0.4.2 |
| 导出命令 | uv run coreai.diffusion.export flux2-klein-4b --platform macOS |
任何人都可用上述命令复现出等价产物。
| 资产 | 大小 | 说明 |
|---|---|---|
Transformer.aimodel | 2.0 GB | DiT,25 blocks。multi-function,含 8 个入口 |
TextEncoder.aimodel | 1.6 GB | Qwen3 编码器,取中间层 9 / 18 / 27 |
VAEDecoder.aimodel / _half | 95 MB ×2 | latent → 像素(1024 / 512) |
VAEEncoder.aimodel / _half | 66 MB ×2 | 像素 → latent(图生图用) |
tokenizer/ | 11 MB | Qwen3 tokenizer |
metadata.json | — | 流水线描述 |
Transformer 的 8 个入口:main、half、img2img_{quarter,half,full}、
img2img_512_{quarter,half,full} —— 共享同一份权重。
import CoreAIDiffusionPipeline
let pipeline = try await Flux2Pipeline(from: modelURL)
let config = PipelineConfiguration(
prompt: "a calico cat wearing a tiny wizard hat",
seed: 42, stepCount: 4, guidanceScale: 1.0,
schedulerType: .discreteFlow)
let result = try await pipeline.generateImages(configuration: config)
图生图额外设置 startingImage 与 referenceGrid(.full / .half / .quarter)。
注意 FLUX.2 忽略 strength,引导强度由 referenceGrid 决定。
| 配置 | 耗时 | 峰值内存 |
|---|---|---|
| 1024×1024,4 步 | 21.1 s | 6.15 GB |
| 1024×1024,8 步 | 38.5 s | 6.15 GB |
| 512×512,4 步 | 7.8 s | 4.36 GB |
| 图生图 1024,half grid | 26.6 s | 7.07 GB |
首次运行约 32.5 s —— Core AI 需在设备端编译一次,
并在 ~/Library/Caches/coreai-cache/ 生成约 3.8 GB 特化缓存;之后每次约 21 s。
系统大版本升级后缓存会失效并重新编译。
.aimodel 的权重已编入编译产物Apache License 2.0,继承自原始模型。完整文本见本仓库 LICENSE。
原始模型版权归 Black Forest Labs 所有。