Upload FP8 quantized model
Browse files
README.md
CHANGED
@@ -19,7 +19,13 @@ base_model:
|
|
19 |
|
20 |
# FLUX.1-dev-ControlNet-Union-Pro-2.0 (fp8)
|
21 |
|
22 |
-
This repository contains an unified ControlNet for FLUX.1-dev model released by [Shakker Labs](https://huggingface.co/Shakker-Labs). We provide an [online demo](https://huggingface.co/spaces/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro-2.0).
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
# Keynotes
|
25 |
In comparison with [Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro](https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro),
|
@@ -131,6 +137,36 @@ You can adjust controlnet_conditioning_scale and control_guidance_end for strong
|
|
131 |
- Pose: use [DWPose](https://github.com/IDEA-Research/DWPose/tree/onnx), controlnet_conditioning_scale=0.9, control_guidance_end=0.65.
|
132 |
- Gray: use cv2.cvtColor, controlnet_conditioning_scale=0.9, control_guidance_end=0.8.
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
# Resources
|
135 |
- [InstantX/FLUX.1-dev-IP-Adapter](https://huggingface.co/InstantX/FLUX.1-dev-IP-Adapter)
|
136 |
- [InstantX/FLUX.1-dev-Controlnet-Canny](https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Canny)
|
|
|
19 |
|
20 |
# FLUX.1-dev-ControlNet-Union-Pro-2.0 (fp8)
|
21 |
|
22 |
+
This repository contains an unified ControlNet for FLUX.1-dev model released by [Shakker Labs](https://huggingface.co/Shakker-Labs). This version has been quantized to FP8 format for optimized inference performance. We provide an [online demo](https://huggingface.co/spaces/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro-2.0).
|
23 |
+
|
24 |
+
# FP8 Quantization
|
25 |
+
This model has been quantized from the original BFloat16 format to FP8 format. The benefits include:
|
26 |
+
- **Reduced Memory Usage**: Approximately 50% smaller model size compared to BFloat16/FP16
|
27 |
+
- **Faster Inference**: Potential speed improvements, especially on hardware with FP8 support
|
28 |
+
- **Minimal Quality Loss**: Carefully calibrated quantization process to preserve output quality
|
29 |
|
30 |
# Keynotes
|
31 |
In comparison with [Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro](https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro),
|
|
|
137 |
- Pose: use [DWPose](https://github.com/IDEA-Research/DWPose/tree/onnx), controlnet_conditioning_scale=0.9, control_guidance_end=0.65.
|
138 |
- Gray: use cv2.cvtColor, controlnet_conditioning_scale=0.9, control_guidance_end=0.8.
|
139 |
|
140 |
+
# Using FP8 Model
|
141 |
+
This repository includes the FP8 quantized version of the model. To use it, you'll need PyTorch with FP8 support:
|
142 |
+
|
143 |
+
```python
|
144 |
+
import torch
|
145 |
+
from diffusers.utils import load_image
|
146 |
+
from diffusers import FluxControlNetPipeline, FluxControlNetModel
|
147 |
+
|
148 |
+
base_model = 'black-forest-labs/FLUX.1-dev'
|
149 |
+
controlnet_model_union_fp8 = 'YOUR_USERNAME/FLUX.1-dev-ControlNet-Union-Pro-2.0-fp8'
|
150 |
+
|
151 |
+
# Load using FP8 data type
|
152 |
+
controlnet = FluxControlNetModel.from_pretrained(controlnet_model_union_fp8, torch_dtype=torch.float8_e4m3fn)
|
153 |
+
pipe = FluxControlNetPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16)
|
154 |
+
pipe.to("cuda")
|
155 |
+
|
156 |
+
# The rest of the code is the same as with the original model
|
157 |
+
```
|
158 |
+
|
159 |
+
See `fp8_inference_example.py` for a complete example.
|
160 |
+
|
161 |
+
# Pushing Model to Hugging Face Hub
|
162 |
+
To push your FP8 quantized model to the Hugging Face Hub, use the included script:
|
163 |
+
|
164 |
+
```bash
|
165 |
+
python push_model_to_hub.py --repo_id "YOUR_USERNAME/FLUX.1-dev-ControlNet-Union-Pro-2.0-fp8"
|
166 |
+
```
|
167 |
+
|
168 |
+
You will need to have the `huggingface_hub` library installed and be logged in with your Hugging Face credentials.
|
169 |
+
|
170 |
# Resources
|
171 |
- [InstantX/FLUX.1-dev-IP-Adapter](https://huggingface.co/InstantX/FLUX.1-dev-IP-Adapter)
|
172 |
- [InstantX/FLUX.1-dev-Controlnet-Canny](https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Canny)
|