File size: 1,261 Bytes
c59da89 ebd4da2 c59da89 447ccda ee4ce9e 6385211 447ccda fc26347 0715887 447ccda 6c56669 447ccda 2a38a3a 447ccda 462e3fb 447ccda 2a38a3a 447ccda c59da89 |
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 |
---
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") |