FLUX.1-dev
Black Forest Labs
FLUX.1 [dev] is a 12 billion parameter rectified flow transformer that generates images from text descriptions. Use this model for the fastest inference with the TheStage AI framework "Elastic Models."
Perfomance
Latency Benchmarks
We have measured the latency of different sizes of FLUX.1-dev model (S, M, L, XL, original) on various GPUs. The measurements were taken for generating images of size 1024x1024 pixels.
Latency Benchmarking
Latency Benchmark Results
Latency (in seconds) for generating a 1024x1024 image using different model sizes on various hardware setups.
| GPU/Model Size | S | M | L | XL | Original |
|---|---|---|---|---|---|
| H100 | 2.88 | 3.06 | 3.25 | 4.18 | 6.46 |
| L40s | 9.22 | 10.07 | 10.67 | 14.39 | 16 |
| B200 | 1.93 | 2.04 | 2.15 | 2.77 | 4.52 |
| GeForce RTX 5090 | 5.79 | N/A | N/A | N/A | N/A |
LoRA Latency Benchmark Results
Time in seconds to generate one 1024x1024 image (average over 3 LoRAs — rank 32, 32, 256).
| GPU/Model Size | S | M | L | XL | Original (unfused) |
|---|---|---|---|---|---|
| H100 | 4.45 | 4.56 | 4.69 | 5.38 | 7.64 |
| L40s | 11.36 | 11.99 | 12.59 | 15.63 | 19.02 |
| B200 | 3.16 | 3.23 | 3.29 | 2.79 | 5.2 |
| GeForce RTX 5090 | 7.54 | N/A | N/A | N/A | N/A |
Benchmarking Methodology
The benchmarking was performed on a single GPU with a batch size of 1. Each model was run for 10 iterations, and the average latency was calculated.
Algorithm summary:
Load the FLUX.1-dev model with the specified size (S, M, L, XL, original).
Move the model to the GPU.
Prepare a sample prompt for image generation.
Run the model for a number of iterations (e.g., 10) and measure the time taken for each iteration. On each iteration:
Synchronize the GPU to flush any previous operations.
Record the start time.
Generate the image using the model.
Synchronize the GPU again.
Record the end time and calculate the latency for that iteration.
Calculate the average latency over all iterations.
Reproduce benchmarking
import torch
from elastic_models.diffusers import FluxPipeline
mode_name = 'black-forest-labs/FLUX.1-dev'
hf_token = ''
device = torch.device("cuda")
pipeline = FluxPipeline.from_pretrained(
mode_name,
torch_dtype=torch.bfloat16,
token=hf_token,
# 'original' for original model
# 'S', 'M', 'L', 'XL' for accelerated models
mode='S'
)
pipeline.to(device)
prompt = ["Kitten eating a banana"]
generate_kwargs={
"height": 1024,
"width": 1024,
"num_inference_steps": 28,
"cfg_scale": 0.0
}
import time
def evaluate_pipeline():
torch.cuda.synchronize()
start_time = time.time()
output = pipeline(
prompt=prompt,
**generate_kwargs
)
torch.cuda.synchronize()
end_time = time.time()
return end_time - start_time
# Warm-up
for _ in range(5):
evaluate_pipeline()
# Benchmarking
num_runs = 10
total_time = 0.0
for _ in range(num_runs):
latency = evaluate_pipeline()
total_time += latency
average_latency = total_time / num_runs
print(f"Average Latency over {num_runs} runs: {average_latency} seconds")