kohya-ss / kohya-ss/sd-scripts

Why does the 'loss=nan' appear when finetuning model using fp16 or bf16 mixed precision in 'fine_tune.py' ?

Open
#135 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

Same as title. This problem has existed since the v9 version. It is related to the GPU type. It appears in 3090, A40, but doesn't appear in A100.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with fine_tune.py and reproduce the reported loss=nan behavior using fp16 and bf16 mixed precision on a 3090 or A40, then compare it with an A100. Determine the conditions that distinguish the affected GPU types and document a clear fix or limitation, with a reproducible test case.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.