Skip to content

Error at generating a sample preview image in training Lora (MAC) #390

@vkbest

Description

@vkbest

I have configured the Mac and training but if I try to get preview every x steps or epochs I get this error:

generating sample images at step / サンプル画像生成 ステップ: 50
Traceback (most recent call last):
  File "/Users/myuser/Documents/kohya_ss/train_network.py", line 748, in <module>
    train(args)
  File "/Users/myuser/Documents/kohya_ss/train_network.py", line 616, in train
    train_util.sample_images(
  File "/Users/myuser/Documents/kohya_ss/library/train_util.py", line 2959, in sample_images
    cuda_rng_state = torch.cuda.get_rng_state()
  File "/Users/myuser/Documents/kohya_ss/venv/lib/python3.10/site-packages/torch/cuda/random.py", line 22, in get_rng_state
    _lazy_init()
  File "/Users/myuser/Documents/kohya_ss/venv/lib/python3.10/site-packages/torch/cuda/__init__.py", line 239, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
steps:   4%|████████▍                                                                                                                                                                                         | 50/1150 [01:07<24:42,  1.35s/it, loss=0.0911]
Traceback (most recent call last):
  File "/Users/myuser/Documents/kohya_ss/venv/bin/accelerate", line 8, in <module>
    sys.exit(main())
  File "/Users/myuser/Documents/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 45, in main
    args.func(args)
  File "/Users/myuser/Documents/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/launch.py", line 1104, in launch_command
    simple_launcher(args)
  File "/Users/myuser/Documents/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/launch.py", line 567, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)

Looks like the preview sample part try to force making a preview in CUDA, despite I'm using MPS (metal performance shaders from Apple) for training.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions