Save Checkpoint and ModelSave nodes crash ComfyUI when saving Flux Dev bfloat16 + Lora
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
### Expected Behavior
Save Checkpoint and ModelSave nodes should not crash ComfyUI when saving Flux Dev bfloat16 + Lora
### Actual Behavior
Save Checkpoint and ModelSave nodes crash ComfyUI when saving Flux Dev bfloat16 + Lora.
I noticed that VRAM consumption keeps growing until it reaches the 16GB limit, and then it crashes.

I tested with different Loras, for example: [Example Lora](https://huggingface.co/alexds9/Flux_Lora_Test_01/blob/main/model_15.safetensors)
Simple workflow:
[flux+lora_modelsave_simple_workflow.json](https://github.com/user-attachments/files/16674948/flux%2Blora_modelsave_simple_workflow.json)
I tested it with all custom nodes disabled, but it still crashed.
But when I tested it without loading a Lora, it was able to save the model, so it seems that loading the Lora is contributing to the failure.
### Steps to Reproduce
Loading Flux Dev bfloat16 + Lora and saving it with Save Checkpoint and ModelSave.
Workflow and info attached.
### Debug Logs
```powershell
got prompt
model weight dtype torch.bfloat16, manual cast: None
model_type FLUX
Requested to load FluxClipModel_
Loading 1 new model
loaded completely 0.0 4777.53759765625 True
clip missing: ['text_projection.weight']
Requested to load Flux
Loading 1 new model
loaded partially 14695.825 14688.193481445312 0
Killed
```
### Other
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.