kohya-ss / kohya-ss/sd-scripts
At resuming: RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.2k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
When resuming flux training sd-scripts meets an error of;
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
options (difference from previous train: --resume option):
accelerate launch flux_train_network.py --resume /media/iamal/workspace/testspace/one/flux-abc-000165-state --ae /media/iamal/workspace/sd3/ae.safetensors --blocks_to_swap 35 --bucket_reso_steps 128 --cache_latents_to_disk --cache_text_encoder_outputs_to_disk --clip_l /media/iamal/workspace/sd3/clip_l.safetensors --clip_skip 2 --dataset_config dataset_1024.toml --discrete_flow_shift 3.1582 --enable_bucket --highvram --gradient_checkpointing --guidance_scale 3.5 --learning_rate 1.0 --logging_dir /media/iamal/workspace/testspace/one/logs --loss_type l2 --lr_warmup_steps 0.1 --network_alpha 16.0 --network_dim 32 --network_dropout 0.2 --network_module networks.lora_flux --network_train_unet_only --max_bucket_reso 2048 --max_data_loader_n_workers 2 --max_train_epochs 272 --max_timestep 1000 --max_train_steps 300000 --min_bucket_reso 256 --min_snr_gamma 5.0 --mixed_precision bf16 --model_prediction_type raw --optimizer_type prodigyplus.ProdigyPlusScheduleFree --optimizer_args "prodigy_steps=123624" --output_dir /media/iamal/workspace/testspace/one --output_name flux-abc --persistent_data_loader_workers --pretrained_model_name_or_path /media/iamal/workspace/sd3/flux1-dev.safetensors --sample_every_n_steps 50 --sample_prompts /media/iamal/workspace/testspace/one/sample/prompt.txt --sample_sampler k_dpm_2_a --save_every_n_epochs 1 --save_precision float --save_model_as safetensors --save_state --sdpa --seed 1234 --t5xxl /media/iamal/workspace/sd3/t5xxl_fp16.safetensors --t5xxl_max_token_length 256 --unet_lr 1.0 --wandb_run_name abc --xformers
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with flux_train_network.py and the --resume path, using the command and checkpoint details in the issue to reproduce the failure. Trace where resumed state tensors are restored and identify the device mismatch; done means resuming this Flux training setup completes without the cuda:0/CPU RuntimeError.
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