bmaltais / kohya_ss

Apache License 2.0
9.61k stars 1.24k forks source link

" RuntimeError: User specified autocast device_type must be 'cuda' or 'cpu' " when training. #1568

Closed AndItDontFade closed 9 months ago

AndItDontFade commented 1 year ago

Discussed in https://github.com/bmaltais/kohya_ss/discussions/1567

Originally posted by **AndItDontFade** October 2, 2023 When I attempt to train my Lora model (Start training) after setting all parameters, it begins to work for a minute and then gives me this error `RuntimeError: User specified autocast device_type must be 'cuda' or 'cpu' ` I'm using an M1 Macbook pro, 2021, choosing Stable diffusion v1-5-pruned.safetensors as my model. I'm using 17 images for the training and all images have been found This is the traceback: `Traceback (most recent call last): File "/Users/I585070/Documents/Kohya_ss/kohya_ss/venv/bin/accelerate", line 8, in sys.exit(main()) File "/Users/I585070/Documents/Kohya_ss/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 47, in main args.func(args) File "/Users/I585070/Documents/Kohya_ss/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/launch.py", line 986, in launch_command simple_launcher(args) File "/Users/I585070/Documents/Kohya_ss/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/launch.py", line 628, in simple_launcher raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd) subprocess.CalledProcessError: Command '['/Users/I585070/Documents/Kohya_ss/kohya_ss/venv/bin/python', './train_db.py', '--enable_bucket', '--min_bucket_reso=256', '--max_bucket_reso=2048', '--pretrained_model_name_or_path=/Users/I585070/Documents/STABLE_DIFFUSION_WEBUI/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned.safetensors', '--train_data_dir=/Users/I585070/Downloads/Lora_Training/images', '--resolution=768,768', '--output_dir=/Users/I585070/Downloads/Lora_Training/model', '--logging_dir=/Users/I585070/Downloads/Lora_Training/log', '--save_model_as=safetensors', '--output_name=TShirts', '--lr_scheduler_num_cycles=10', '--max_data_loader_n_workers=0', '--learning_rate=1e-05', '--lr_scheduler=cosine', '--lr_warmup_steps=289', '--train_batch_size=1', '--max_train_steps=2890', '--save_every_n_epochs=1', '--mixed_precision=fp16', '--save_precision=fp16', '--cache_latents', '--optimizer_type=AdamW8bit', '--max_data_loader_n_workers=0', '--bucket_reso_steps=64', '--xformers', '--bucket_no_upscale', '--noise_offset=0.0']' returned non-zero exit status 1.`
mercury1989 commented 1 year ago

train parameters:--mixed_precision="no" --save_precision="float"