目次

Web検索はbingがおすすめ!

sd-scripts を実行すると 「Error no kernel image is available for execution on the device at line 167 in file D:\ai\tool\bitsandbytes\csrc\ops.cu」 エラーが発生する - Stable Diffusion

sd-scripts を実行すると「Error no kernel image is available for execution on the device at line 167 in file D:\ai\tool\bitsandbytes\csrc\ops.cu」 が発生する原因と対処法を紹介します。

現象

sd-scripts のプログラムを実行すると、次のエラーが発生しプログラムが停止します。
エラーメッセージ
Error no kernel image is available for execution on the device at line 167 in file D:\ai\tool\bitsandbytes\csrc\ops.cu 

原因

--optimizer_type で設定したオプションが実行環境では対応していない可能性があります。

対処法

--optimizer_typeの値を別の値に変更します。
多くの場合、--optimizer_type=AdamW8bit を指定しますが、ハードウェアによっては対応していない場合があります。 エラーが発生する場合は、--optimizer_type=AdamW に変更してエラーが解消されるかを確認します。
コマンド例
accelerate launch
  --num_cpu_threads_per_process 1
  train_network.py
  --pretrained_model_name_or_path=C:\(モデルのパス).safetensors
  --dataset_config=C:\(config.tomlのパス)\config.toml
  --output_dir=C:\(出力ディレクトリのパス)\output
  --output_name=zunko --save_model_as=safetensors
  --prior_loss_weight=1.0
  --resolution=512,512
  --train_batch_size=1
  --max_train_epochs=10
  --learning_rate=1e-4
  --optimizer_type=AdamW8bit
  --xformers
  --mixed_precision=fp16
  --cache_latents
  --gradient_checkpointing
  --save_every_n_epochs=1
  --network_module=networks.lora

--optimizer_type=AdamW8bitでエラーが発生する場合は、--optimizer_type=AdamW に変更します。
コマンド例 (変更後)
accelerate launch
  --num_cpu_threads_per_process 1
  train_network.py
  --pretrained_model_name_or_path=C:\(モデルのパス).safetensors
  --dataset_config=C:\(config.tomlのパス)\config.toml
  --output_dir=C:\(出力ディレクトリのパス)\output
  --output_name=zunko --save_model_as=safetensors
  --prior_loss_weight=1.0
  --resolution=512,512
  --train_batch_size=1
  --max_train_epochs=10
  --learning_rate=1e-4
  --optimizer_type=AdamW
  --xformers
  --mixed_precision=fp16
  --cache_latents
  --gradient_checkpointing
  --save_every_n_epochs=1
  --network_module=networks.lora
著者
iPentecのメインデザイナー
Webページ、Webクリエイティブのデザインを担当。PhotoshopやIllustratorの作業もする。
掲載日: 2023-05-15
iPentec all rights reserverd.