huggingface / huggingface/diffusers
set mixed_precision="fp16",but the model is not fp16
- Dominant language
- Python
- Stars
- 34.5k
- Forks
- 7.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 91
Description
### Describe the bug
I trained the control net of SDXL using the mixed prediction="fp16" parameter, but the trained model did not have the suffix. fp16. safetensors. But it's a 5G file. I see that the Controlnet on HuggFace will have a 5G file and a 2.5G file with fp16.
### Reproduction
accelerate launch train_controlnet_sdxl.py --pretrained_model_name_or_path=$MODEL_DIR --output_dir=$OUTPUT_DIR --pretrained_vae_model_name_or_path=$VAE --dataset_name=/root/autodl-tmp/datasets/ --mixed_precision="fp16" --resolution=1024 --learning_rate=1e-5 --max_train_steps=20000 --validation_image "/root/test.jpg" --validation_prompt "bedroom" --validation_steps=500 --train_batch_size=2 --gradient_accumulation_steps=4 --report_to="wandb" --seed=42 --checkpointing_steps=2000 --cache_dir=/root/autodl-tmp/cache/
### Logs
_No response_
### System Info
diffuser 0.28 , linux, python 3.10.11
### Who can help?
_No response_
Contributor guide
Research direction
Start with train_controlnet_sdxl.py and the supplied accelerate launch command, then trace how mixed_precision="fp16" affects training and checkpoint saving. Compare the resulting safetensors artifacts with the expected fp16 and full-size files; done requires a confirmed explanation or reproducible fix for the reported file size and dtype behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100