kohya-ss / kohya-ss/sd-scripts
CFG with full finetuning of Flux
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.2k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
Hello,
I've ran a full finetuning on Flux using guidance_scale=1.0.
Now when I try to inference the model, I need to set the CFG scale > 1 because if I let it at 1 to disable it like I'm used to do with Flux, then the results are washed up.
I'm used to training loras with SimpleTuner and using guidance_scale=1 during training doesn't require setting CFG > 1 during inference. Is that a problem due to full finetuning or is it a bug ?
Here is my full training command :
`accelerate launch --mixed_precision bf16 --num_cpu_threads_per_process 1 flux_train.py ^
--pretrained_model_name_or_path "flux1-dev.safetensors" ^
--clip_l "clip_l.safetensors" --t5xxl "t5xxl_fp16.safetensors" --ae "ae.sft" ^
--save_model_as safetensors --sdpa --persistent_data_loader_workers --max_data_loader_n_workers 2 ^
--seed 42 --gradient_checkpointing --mixed_precision bf16 --save_precision bf16 ^
--dataset_config "dataset.toml" --output_dir "output" --output_name output_5e5 ^
--learning_rate 4e-5 --max_train_epochs 150 --sdpa --highvram --cache_text_encoder_outputs_to_disk --cache_latents_to_disk --save_every_n_epochs 10 ^
--optimizer_type adafactor --optimizer_args "relative_step=False" "scale_parameter=False" "warmup_init=False" ^
--timestep_sampling sigmoid --model_prediction_type raw --guidance_scale 1.0 ^
--enable_wildcard ^
--fused_backward_pass --double_blocks_to_swap 6 --cpu_offload_checkpointing --full_bf16`
Here are two samples using Distilled CFG at 3.5 using Forge UI. The first one uses CFG at 1 and the second one uses CFG at 4.
Sample CFG 1:

Sample CFG 4:

"A dressed table with a cup of coffee. On the cup of coffee is written "FLUX CFG". Very detailed, professional photography."

Any help would be appreciated :)
Thanks
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with flux_train.py and trace how guidance_scale is used during full finetuning, then compare that behavior with inference at CFG 1 and CFG 4 using the command and examples in the report. Done means determining whether the difference is expected or a bug, and documenting the conclusion or adding a verified correction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100