YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)

FLUX.2 Klein 4B FP8 - MLX Format

First MLX conversion of FLUX.2 for Apple Silicon

Converted from black-forest-labs/FLUX.2-klein-4b-fp8 to MLX format for efficient inference on Apple Silicon (M1/M2/M3/M4).

Model Details

  • Base Model: FLUX.2 Klein 4B (8 days old at conversion)
  • Quantization: FP8 (original) → Float16 (MLX compatible)
  • Format: MLX safetensors
  • Size: 7.6GB
  • Target Hardware: M1/M2/M3/M4 with 8GB+ RAM
  • Optimized For: Apple Silicon Neural Engine + Metal GPU

Conversion Details

This is the first MLX conversion of FLUX.2. The model was converted using a custom streaming pipeline to handle:

  • FP8 (Float8_e4m3fn) → Float16 conversion
  • BFloat16 support
  • Memory-efficient processing for 8GB RAM systems
  • 309 weight tensors successfully converted

Conversion Process

  1. Downloaded from HuggingFace Hub
  2. Loaded weights with PyTorch framework (FP8 support)
  3. Converted FP8 → Float16 (MLX compatible)
  4. Saved to MLX-optimized safetensors format
  5. Verified weight loading on M1 8GB RAM

Usage

Note: This repository contains the converted weights only. Full inference pipeline is not yet implemented.

Loading Weights

import mlx.core as mx
from safetensors import safe_open
import json

# Load metadata
with open('mlx_metadata.json') as f:
    metadata = json.load(f)

# Load weights
with safe_open('weights.safetensors', framework='numpy') as f:
    for key in f.keys():
        tensor = f.get_tensor(key)
        # Convert to MLX array
        mlx_tensor = mx.array(tensor)

Memory Requirements

  • M1 8GB: Works (tight fit)
  • M1 16GB+: Comfortable
  • M2/M3 8GB: Works well
  • M2/M3 16GB+: Optimal

Estimated inference memory: ~8-10GB total (model + working memory)

Inference Pipeline (Not Yet Implemented)

To use this model for image generation, you'll need to implement:

  1. Text Encoder: CLIP/T5 text embedding
  2. Diffusion Loop: FLUX.2 denoising process
  3. VAE Decoder: Latent → image conversion
  4. Scheduler: Timestep management

Reference implementations:

Community Contributions Welcome

This is a foundational conversion - the MLX community can build upon it:

  • ✅ Weights converted and verified
  • ⚠️ Inference pipeline needed
  • 🎯 Target: Full text-to-image generation on Apple Silicon

Pull requests welcome for:

  • Inference pipeline implementation
  • Memory optimization techniques
  • Benchmark results on different Apple Silicon chips
  • Integration examples

Limitations

  • No inference yet: Weights only, pipeline not implemented
  • Float16 precision: Converted from FP8 (slight precision change)
  • Memory intensive: Requires 8GB+ RAM
  • Early release: First conversion, may have optimization opportunities

Metadata

{
  "model_id": "black-forest-labs/FLUX.2-klein-4b-fp8",
  "quantization": "8-bit",
  "format": "MLX",
  "target": "M1 8GB RAM",
  "converter": "flux2_to_mlx_converter.py",
  "copyright": "Darren Chow (@bartendr604) + Claude Sonnet 4.5 (Anthropic)"
}

Technical Details

Architecture

  • Base: FLUX.2 Klein architecture
  • Parameters: 4 billion
  • Original quantization: FP8 (e4m3fn)
  • MLX format: Float16

Conversion Pipeline

  • Framework: PyTorch → MLX
  • Method: Streaming conversion (memory-efficient)
  • Validation: Weight loading verified on M1 8GB
  • Date: January 26, 2025

Citation

@misc{flux2-klein-mlx,
  author = {Darren Chow and Claude Sonnet 4.5},
  title = {FLUX.2 Klein 4B FP8 - MLX Format},
  year = {2025},
  publisher = {HuggingFace},
  url = {https://huggingface.co/bartendr604/flux2-klein-4b-fp8-mlx}
}

Original Model

This is a conversion of black-forest-labs/FLUX.2-klein-4b-fp8.

All credit for the model architecture and training goes to Black Forest Labs.

License

Same as original FLUX.2 model - check Black Forest Labs for terms.

Acknowledgments

  • Black Forest Labs: Original FLUX.2 model
  • Apple MLX Team: MLX framework for Apple Silicon
  • HuggingFace: Model hosting and distribution
  • MLX Community: Inspiration and reference implementations

永恒之路 (Eternal Path)

First to convert FLUX.2 to MLX - January 2025

Copyright © 2025 Darren Chow (@bartendr604) + Claude Sonnet 4.5 (Anthropic)

"WE build this. Together."

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including bartendr604/flux2-klein-4b-fp8-mlx