File size: 3,016 Bytes
616df91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
library_name: mlx
tags:
- mlx
- flux
- image-to-image
- quantized
- swift
pipeline_tag: image-to-image
license: other
license_name: flux-1-dev-non-commercial-license
license_link: https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md
---

# FLUX.1-Kontext 4-bit Quantized for MLX

This is a 4-bit quantized version of the FLUX.1-Kontext-dev model optimized for use with MLX and flux.swift. The model size has been reduced from ~24GB to 9.2GB while maintaining excellent image-to-image generation quality.

Quantized using [flux.swift](https://github.com/mzbac/flux.swift), a Swift implementation of FLUX models for Apple Silicon.

## Model Details
- **Quantization**: 4-bit with group size 64
- **Total Size**: 9.2GB
- **Original Model**: [black-forest-labs/FLUX.1-Kontext-dev](https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev)
- **Framework**: MLX (Metal Performance Shaders)
- **Components**: Transformer, VAE, CLIP text encoder, T5 text encoder

## Usage

This model requires the [flux.swift](https://github.com/mzbac/flux.swift) implementation. Please refer to the repository for installation and usage instructions.

### Quick Start
```bash
# Load and use the quantized model for image-to-image generation
flux.swift.cli \
  --load-quantized-path /path/to/this/model \
  --hf-token YOUR_HF_TOKEN \
  --init-image-path /path/to/input/image.png \
  --prompt "Your transformation prompt here" \
  --output output.png
```

### Recommended Parameters
- **Steps**: 30
- **Guidance Scale**: 3.5
- **Authentication**: Requires Hugging Face token
- **Input**: Requires `--init-image-path` for image-to-image generation

### Example with Parameters
```bash
flux.swift.cli \
  --load-quantized-path /path/to/this/model \
  --hf-token YOUR_HF_TOKEN \
  --init-image-path ./reference.png \
  --prompt "transform this into a watercolor painting with soft pastel tones" \
  --steps 30 \
  --guidance 3.5 \
  --width 512 \
  --height 512 \
  --seed 42 \
  --output watercolor_painting.png
```

## License

This model is a quantized version of FLUX.1-Kontext-dev, which is licensed under the FLUX.1 [dev] Non-Commercial License. Please review the original license terms:
- Original model: https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev
- License: https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md
- Commercial licensing available at: https://bfl.ai/pricing/licensing

## Performance
- **Memory Usage**: Reduced from ~24GB to 9.2GB
- **Quality**: Excellent preservation of image-to-image generation quality
- **Platform**: Optimized for Apple Silicon Macs

## Citation
```bibtex
@misc{flux-kontext,
  author = {Black Forest Labs},
  title = {FLUX.1-Kontext-dev},
  publisher = {Black Forest Labs},
  year = {2024},
  url = {https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev}
}

@software{flux-swift,
  author = {mzbac},
  title = {flux.swift: Swift implementation of FLUX models},
  url = {https://github.com/mzbac/flux.swift},
  year = {2024}
}
```