kohya-ss / kohya-ss/sd-scripts
SD3 Training Error
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.2k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
When i try to train with a new installation of kohya_ss with sd3-flux.1 branch (checked out today) i always end up with this error:

File "/home/user/Desktop/kohyass/sd-scripts/library/sd3_models.py", line 1591, in forward
tokens = torch.LongTensor(tokens).to(device)
TypeError: expected TensorOptions(dtype=long int, device=cpu, layout=Strided, requires_grad=false (default), pinned_memory=false (default), memory_format=(nullopt)) (got TensorOptions(dtype=long int, device=cuda:0, layout=Strided, requires_grad=false (default), pinned_memory=false (default), memory_format=(nullopt)))
can anyone explain what im doing wrong?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the SD3 training failure on the sd3-flux.1 branch and inspect sd-scripts/library/sd3_models.py around line 1591, where the reported conversion fails. Determine the cause of the CUDA-versus-CPU tensor error and verify that training completes without this exception.
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
- 25/100