SDR β HDR LoRA for FLUX.2-klein-4B
Turn any SDR photo into a scene-referred HDR image (ARRI LogC4 encoding, linear values recoverable up to ~470x). Clipped skies, suns, lamps and speculars are reconstructed instead of staying flat white β ready for EXR export, grading, or IBL.
Highlights
- Prompt-controlled intensity: four control words dial how aggressively highlights are reconstructed, from subtle to sun-level.
- Faithful, not hallucinated: on held-out data the median per-pixel relative error is ~10%, global exposure is self-calibrated, and low-dynamic scenes stay low β the model does not invent highlights that were never there.
- Two formats included:
sdr2hdr-klein4b-v1.safetensors(kohya/musubi naming) andsdr2hdr-klein4b-v1-COMFYUI.safetensors(ComfyUI-native keys).
Quick start (ComfyUI)
- Put
sdr2hdr-klein4b-v1-COMFYUI.safetensorsinmodels/loras/, with FLUX.2 klein-4B as the base model. - Load it with a standard LoRA loader (strength 1.0) and feed the SDR photo as the reference/edit image.
- Prompt:
convert to scene-linear HDR, LogC4 encoded, intense highlights(swap the last words per the table below).
Important β reference image size: resize (aspect-fit + center-crop) the SDR input to exactly the generation resolution before conditioning. A larger reference makes the model reproduce content at 1:1 scale and the output turns into a zoomed crop.
Intensity control
| control word | reconstruction target |
|---|---|
extreme peak luminance |
sun-level sources, up to the LogC4 ceiling (~470x) |
intense highlights |
strong practical lights, tens of x |
strong highlights |
pronounced but moderate highlights (~5x) |
soft dynamic range |
gentle expansion for low-contrast scenes (~2-3x) |
Fixed prompt template: convert to scene-linear HDR, LogC4 encoded, {control word}
Output format
The generated PNG stores raw ARRI LogC4 code values, not sRGB (it looks flat grey in a normal viewer β that is correct). Decode to scene-linear:
V = png / 255
L = (2^(14*(V - c)/b + 6) - 64) / a
a = 2231.8259, b = 0.9071358748778103, c = 0.0928641251221897
Mid-grey maps to 0.18; values above 1.0 are HDR highlights. Write the linear buffer to a 32-bit EXR for VFX / grading / IBL use.
musubi-tuner inference
python src/musubi_tuner/flux_2_generate_image.py \
--model_version klein-4b \
--dit flux-2-klein-4b.safetensors --vae ae.safetensors \
--text_encoder text_encoder/model-00001-of-00002.safetensors \
--control_image_path input_sdr_fitted.png \
--prompt "convert to scene-linear HDR, LogC4 encoded, intense highlights" \
--image_size 768 1360 --infer_steps 28 \
--lora_weight sdr2hdr-klein4b-v1.safetensors \
--save_path out --output_type images
Training & evaluation
LoRA (dim 32) trained with musubi-tuner on ~1k human-curated SDR/HDR pairs
spanning natural scenes, graded cinematic footage and film-production plates.
On held-out samples: median in-band per-pixel relative error ~0.10, exposure
gain 0.87β1.14 (no post-alignment needed), and monotonic peak response across
all four intensity words. See samples/ for input / output / ground-truth
comparisons (shown at β3EV to reveal highlight structure).
Limitations
- Slight highlight overshoot above ~100x on extreme content.
- Trained against synthetic tonemaps; heavily stylized real-world SDR grades may behave as out-of-distribution input.
- Native resolution ~1MP; not intended for radiometric measurement.
License & access
Gated for non-commercial research. Training data has mixed provenance; verify upstream terms for your use case. Base model: FLUX.2-klein-4B (Black Forest Labs).
Model tree for LAXMAYDAY/flux2-klein4b-sdr2hdr-logc4-lora
Base model
black-forest-labs/FLUX.2-klein-4B