|
|
--- |
|
|
tags: |
|
|
- text-to-image |
|
|
- flux |
|
|
- diffusers |
|
|
- quantization |
|
|
license: other |
|
|
language: |
|
|
- en |
|
|
base_model: |
|
|
- black-forest-labs/FLUX.1-dev |
|
|
pipeline_tag: text-to-image |
|
|
--- |
|
|
|
|
|
## Model Overview |
|
|
|
|
|
`Silan10/flux_quantized_half` is a **half-precision (FP16) variant** of the |
|
|
[`black-forest-labs/FLUX.1-dev`](https://huggingface.co/black-forest-labs/FLUX.1-dev) |
|
|
text-to-image model. In this version, the **`transformers`**, **`text_encoder`** and |
|
|
**`text_encoder_2`** folders have been converted to FP16. |
|
|
|
|
|
This repository only changes the **numerical precision of the weights** to |
|
|
`torch.float16` using PyTorch. This is not real quantization (like int8/int4). Still, |
|
|
converting the model to float16 saves memory, reduces RAM usage and speeds up loading times. |
|
|
|
|
|
## Usage |
|
|
|
|
|
```python |
|
|
import torch |
|
|
from diffusers import FluxPipeline |
|
|
|
|
|
pipe = FluxPipeline.from_pretrained( |
|
|
"Silan10/flux_quantized_half", |
|
|
torch_dtype=torch.float16 |
|
|
) |
|
|
pipe.to("cuda") # or pipe.enable_model_cpu_offload() for low VRAM |
|
|
|
|
|
prompt = "Close-up portrait photo of a standing 30 year old female with twin braids hairstyle." |
|
|
image = pipe( |
|
|
prompt, |
|
|
guidance_scale=3.5, |
|
|
num_inference_steps=20, |
|
|
generator=torch.Generator("cpu").manual_seed(0) |
|
|
).images[0] |
|
|
|
|
|
image.save("flux_half_sample.png") |