Upload folder using huggingface_hub
Browse files- README.md +92 -0
- metadata.json +13 -0
- text_encoder/flux1_mlx_model.safetensors +3 -0
- text_encoder_2/flux1_mlx_model-00001-of-00002.safetensors +3 -0
- text_encoder_2/flux1_mlx_model-00002-of-00002.safetensors +3 -0
- transformer/flux1_mlx_model-00001-of-00004.safetensors +3 -0
- transformer/flux1_mlx_model-00002-of-00004.safetensors +3 -0
- transformer/flux1_mlx_model-00003-of-00004.safetensors +3 -0
- transformer/flux1_mlx_model-00004-of-00004.safetensors +3 -0
- vae/flux1_mlx_model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: mlx
|
| 3 |
+
tags:
|
| 4 |
+
- mlx
|
| 5 |
+
- flux
|
| 6 |
+
- image-to-image
|
| 7 |
+
- quantized
|
| 8 |
+
- swift
|
| 9 |
+
pipeline_tag: image-to-image
|
| 10 |
+
license: other
|
| 11 |
+
license_name: flux-1-dev-non-commercial-license
|
| 12 |
+
license_link: https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# FLUX.1-Kontext 4-bit Quantized for MLX
|
| 16 |
+
|
| 17 |
+
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.
|
| 18 |
+
|
| 19 |
+
Quantized using [flux.swift](https://github.com/mzbac/flux.swift), a Swift implementation of FLUX models for Apple Silicon.
|
| 20 |
+
|
| 21 |
+
## Model Details
|
| 22 |
+
- **Quantization**: 4-bit with group size 64
|
| 23 |
+
- **Total Size**: 9.2GB
|
| 24 |
+
- **Original Model**: [black-forest-labs/FLUX.1-Kontext-dev](https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev)
|
| 25 |
+
- **Framework**: MLX (Metal Performance Shaders)
|
| 26 |
+
- **Components**: Transformer, VAE, CLIP text encoder, T5 text encoder
|
| 27 |
+
|
| 28 |
+
## Usage
|
| 29 |
+
|
| 30 |
+
This model requires the [flux.swift](https://github.com/mzbac/flux.swift) implementation. Please refer to the repository for installation and usage instructions.
|
| 31 |
+
|
| 32 |
+
### Quick Start
|
| 33 |
+
```bash
|
| 34 |
+
# Load and use the quantized model for image-to-image generation
|
| 35 |
+
flux.swift.cli \
|
| 36 |
+
--load-quantized-path /path/to/this/model \
|
| 37 |
+
--hf-token YOUR_HF_TOKEN \
|
| 38 |
+
--init-image-path /path/to/input/image.png \
|
| 39 |
+
--prompt "Your transformation prompt here" \
|
| 40 |
+
--output output.png
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
### Recommended Parameters
|
| 44 |
+
- **Steps**: 30
|
| 45 |
+
- **Guidance Scale**: 3.5
|
| 46 |
+
- **Authentication**: Requires Hugging Face token
|
| 47 |
+
- **Input**: Requires `--init-image-path` for image-to-image generation
|
| 48 |
+
|
| 49 |
+
### Example with Parameters
|
| 50 |
+
```bash
|
| 51 |
+
flux.swift.cli \
|
| 52 |
+
--load-quantized-path /path/to/this/model \
|
| 53 |
+
--hf-token YOUR_HF_TOKEN \
|
| 54 |
+
--init-image-path ./reference.png \
|
| 55 |
+
--prompt "transform this into a watercolor painting with soft pastel tones" \
|
| 56 |
+
--steps 30 \
|
| 57 |
+
--guidance 3.5 \
|
| 58 |
+
--width 512 \
|
| 59 |
+
--height 512 \
|
| 60 |
+
--seed 42 \
|
| 61 |
+
--output watercolor_painting.png
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
## License
|
| 65 |
+
|
| 66 |
+
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:
|
| 67 |
+
- Original model: https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev
|
| 68 |
+
- License: https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md
|
| 69 |
+
- Commercial licensing available at: https://bfl.ai/pricing/licensing
|
| 70 |
+
|
| 71 |
+
## Performance
|
| 72 |
+
- **Memory Usage**: Reduced from ~24GB to 9.2GB
|
| 73 |
+
- **Quality**: Excellent preservation of image-to-image generation quality
|
| 74 |
+
- **Platform**: Optimized for Apple Silicon Macs
|
| 75 |
+
|
| 76 |
+
## Citation
|
| 77 |
+
```bibtex
|
| 78 |
+
@misc{flux-kontext,
|
| 79 |
+
author = {Black Forest Labs},
|
| 80 |
+
title = {FLUX.1-Kontext-dev},
|
| 81 |
+
publisher = {Black Forest Labs},
|
| 82 |
+
year = {2024},
|
| 83 |
+
url = {https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev}
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
@software{flux-swift,
|
| 87 |
+
author = {mzbac},
|
| 88 |
+
title = {flux.swift: Swift implementation of FLUX models},
|
| 89 |
+
url = {https://github.com/mzbac/flux.swift},
|
| 90 |
+
year = {2024}
|
| 91 |
+
}
|
| 92 |
+
```
|
metadata.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"quantizationBits" : 4,
|
| 3 |
+
"fluxSwiftVersion" : "1.0.0",
|
| 4 |
+
"createdAt" : "2025-07-03T13:53:16Z",
|
| 5 |
+
"modelType" : "FluxKontextPipeline",
|
| 6 |
+
"components" : [
|
| 7 |
+
"vae",
|
| 8 |
+
"transformer",
|
| 9 |
+
"text_encoder",
|
| 10 |
+
"text_encoder_2"
|
| 11 |
+
],
|
| 12 |
+
"groupSize" : 64
|
| 13 |
+
}
|
text_encoder/flux1_mlx_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:54156802ba34f1d74a31c278b6732bd9f9b48eebe23a96e7e622e4e972d60556
|
| 3 |
+
size 120063422
|
text_encoder_2/flux1_mlx_model-00001-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c957fcd719c5c28d10be72fd3db49d1383d7345867de3f8f501605d2bd61f5c9
|
| 3 |
+
size 1991601865
|
text_encoder_2/flux1_mlx_model-00002-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6f0ae73a35ed1e6ad1086cd22e84ccb7ba9305f0a3cf3e2cb5c605df008fae36
|
| 3 |
+
size 876727869
|
transformer/flux1_mlx_model-00001-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b96c0daedc735292ad11634a7ae7549f3f7e21356f9be07668dad01bf16213b9
|
| 3 |
+
size 1983712650
|
transformer/flux1_mlx_model-00002-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aec0bd0ec48ad4d11b2222ccc221310e8c9a30f62f9a396714a70141596469dc
|
| 3 |
+
size 1973493562
|
transformer/flux1_mlx_model-00003-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:31f033aac0c49a34a75aa346cda1bc96ed1de520bb3ac3a10727f3c34e471b1d
|
| 3 |
+
size 1997990940
|
transformer/flux1_mlx_model-00004-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:79e4b26f18ba3984fd3b940925910a1c7f01949f7b28814174ec0e9c8fe063d4
|
| 3 |
+
size 744319382
|
vae/flux1_mlx_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f6fe16e4a7197d0740d1ede4d281777af0a40ff38aa592da8dadce71505b9c19
|
| 3 |
+
size 164654249
|