kohya-ss / kohya-ss/sd-scripts
During training, loss=nan and a broken LoRA is generated
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.2k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
Learning LoRA with the following parameters results in loss=nan.
The resulting LoRA file is corrupt
Is there anything I can do to improve it?
xformers and others are recommended
---------------------------------------------------------
accelerate launch --num_cpu_threads_per_process 1 train_network.py
--pretrained_model_name_or_path=J:\stable-diffusion-webui\models\Stable-diffusion\zmodels_0_marge_source\NAIbasil.safetensors
--train_data_dir=J:\sd-scripts\training
--output_dir=J:\sd-scripts\output
--reg_data_dir=J:\sd-scripts\seisoku
--resolution=512,512
--train_batch_size=6
--unet_lr=5e-5
--text_encoder_lr=5e-3
--max_train_epochs=10
--save_every_n_epochs=1
--save_model_as=safetensors
--clip_skip=2
--seed=42
--color_aug
--min_bucket_reso=320
--max_bucket_reso=1024
--network_module=networks.lora
--lr_scheduler=cosine_with_restarts
--lr_warmup_steps=500
--keep_tokens=2
--shuffle_caption
--network_dim=128
--network_alpha=64
--enable_bucket
--mixed_precision=fp16
--xformers
--use_8bit_adam
--lr_scheduler_num_cycles=4
--caption_extension=.txt
--persistent_data_loader_workers
--bucket_no_upscale
--caption_dropout_rate=0.05
---------------------------------------------------------

Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the reported command through train_network.py with the supplied parameters, then inspect where the loss first becomes NaN and how networks.lora produces the output. Confirm whether the generated safetensors file can be loaded and whether a successful run produces finite loss and a valid LoRA file.
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
- Needs clarification
- Newbie friendliness
- 30/100