Want to run kohya_ss from command prompt instead of browser

Hello

I am trying to run “kohya_ss” from command prompt instead of browser:

I have the following script

# -*- coding: utf-8 -*-

import os
import subprocess
import toml
import einops
import imagesize
import voluptuous

# Change to Kohya GUI base directory (double-check the path)
os.chdir(r"D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\sd-scripts")  # Or kohya_sskohya_gui depending on where the script is

# Config file path (LoRA training settings)
config_file = r"D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\models\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\config_lora-20250403-132700.toml"

# Confirm that train_network.py exists in the directory
train_script_path = os.path.join(os.getcwd(), "train_network.py")  # Update if the script is named differently

# Check if the script exists in the expected directory
if not os.path.exists(train_script_path):
    print(f"Error: {train_script_path} not found. Please check the script name or directory.")
else:
    # Build the command — ensure you are launching the correct script
    command = [
        "accelerate", "launch",
        "train_network.py",   # Update if the script name differs (e.g., 'kohya_train_network.py')
        "--config_file", config_file
    ]

    print(f"🚀 Launching Kohya training with: {config_file}")
    try:
        subprocess.run(command, check=True)
    except subprocess.CalledProcessError as e:
        print(f"Error occurred while running the training script: {e}")

I am getting the error

python train_lora.py
?? Launching Kohya training with: D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\models\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\config_lora-20250403-132700.toml
2025-04-14 11:30:36 INFO     Loading settings from                                                                                                                                               train_util.py:4177
                             D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\models\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\config_lora-20250403-132700.toml
                             ...
                    INFO     D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\models\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\config_lora-20250403-132700      train_util.py:4196
2025-04-14 11:30:36 INFO     prepare tokenizer                                                                                                                                                   train_util.py:4668
2025-04-14 11:30:37 INFO     update token length: 75                                                                                                                                             train_util.py:4685
                    INFO     Using DreamBooth method.                                                                                                                                          train_network.py:172
                    INFO     prepare images.                                                                                                                                                     train_util.py:1815
                    INFO     found directory D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\trained-model\img\40_10Images 0Parameters contains 10 image files                                     train_util.py:1762
                    INFO     400 train images with repeating.                                                                                                                                    train_util.py:1856
                    INFO     0 reg images.                                                                                                                                                       train_util.py:1859
                    WARNING  no regularization images / 正則化画像が見つかりませんでした                                                                                                         train_util.py:1864
                    INFO     [Dataset 0]                                                                                                                                                         config_util.py:572
                               batch_size: 1
                               resolution: (512, 512)
                               enable_bucket: True
                               network_multiplier: 1.0
                               min_bucket_reso: 256
                               max_bucket_reso: 2048
                               bucket_reso_steps: 64
                               bucket_no_upscale: True

                               [Subset 0 of Dataset 0]
                                 image_dir: "D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\trained-model\img\40_10Images 0Parameters"
                                 image_count: 10
                                 num_repeats: 40
                                 shuffle_caption: False
                                 keep_tokens: 0
                                 keep_tokens_separator:
                                 caption_separator: ,
                                 secondary_separator: None
                                 enable_wildcard: False
                                 caption_dropout_rate: 0.0
                                 caption_dropout_every_n_epoches: 0
                                 caption_tag_dropout_rate: 0.0
                                 caption_prefix: None
                                 caption_suffix: None
                                 color_aug: False
                                 flip_aug: False
                                 face_crop_aug_range: None
                                 random_crop: False
                                 token_warmup_min: 1,
                                 token_warmup_step: 0,
                                 alpha_mask: False,
                                 is_reg: False
                                 class_tokens: 10Images 0Parameters
                                 caption_extension: .txt


                    INFO     [Dataset 0]                                                                                                                                                         config_util.py:578
                    INFO     loading image sizes.                                                                                                                                                 train_util.py:911
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 640.02it/s]
                    INFO     make buckets                                                                                                                                                         train_util.py:917
                    WARNING  min_bucket_reso and max_bucket_reso are ignored if bucket_no_upscale is set, because bucket reso is defined by image size automatically /                            train_util.py:934
                             bucket_no_upscaleが指定された場合は、bucketの解像度は画像サイズから自動計算されるため、min_bucket_resoとmax_bucket_resoは無視されます
                    INFO     number of images (including repeats) / 各bucketの画像枚数(繰り返し回数を含む)                                                                                      train_util.py:963
                    INFO     bucket 0: resolution (704, 320), count: 400                                                                                                                          train_util.py:968
                    INFO     mean ar error (without repeats): 0.09826218809406236                                                                                                                 train_util.py:973
                    INFO     preparing accelerator                                                                                                                                             train_network.py:225
D:\Ganu\AIImage\huggingface\kohya_ss\Python310\lib\site-packages\accelerate\accelerator.py:506: UserWarning: `log_with=tensorboard` was passed but no supported trackers are currently installed.
  warnings.warn(f"`log_with={log_with}` was passed but no supported trackers are currently installed.")
accelerator device: cpu
                    INFO     loading model for process 0/1                                                                                                                                       train_util.py:4826
                    INFO     load Diffusers pretrained models: stabilityai/stable-diffusion-xl-base-1.0                                                                                          train_util.py:4788
Loading pipeline components...: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:01<00:00,  2.89it/s]
You have disabled the safety checker for <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 .
2025-04-14 11:30:39 INFO     UNet2DConditionModel: 128, [5, 10, 20], 2048, True, None                                                                                                         original_unet.py:1387
Traceback (most recent call last):
  File "D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\sd-scripts\train_network.py", line 1242, in <module>
    trainer.train(args)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\sd-scripts\train_network.py", line 234, in train
    model_version, text_encoder, vae, unet = self.load_target_model(args, weight_dtype, accelerator)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\sd-scripts\train_network.py", line 101, in load_target_model
    text_encoder, vae, unet, _ = train_util.load_target_model(args, weight_dtype, accelerator)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\sd-scripts\library\train_util.py", line 4828, in load_target_model
    text_encoder, vae, unet, load_stable_diffusion_format = _load_target_model(
  File "D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\sd-scripts\library\train_util.py", line 4804, in _load_target_model
    original_unet = UNet2DConditionModel(
  File "D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\sd-scripts\library\original_unet.py", line 1427, in __init__
    attn_num_head_channels=attention_head_dim[i],
IndexError: list index out of range
Traceback (most recent call last):
  File "D:\Ganu\AIImage\huggingface\kohya_ss\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\Ganu\AIImage\huggingface\kohya_ss\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\Python310\Scripts\accelerate.exe\__main__.py", line 7, in <module>
  File "D:\Ganu\AIImage\huggingface\kohya_ss\Python310\lib\site-packages\accelerate\commands\accelerate_cli.py", line 50, in main
    args.func(args)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\Python310\lib\site-packages\accelerate\commands\launch.py", line 1213, in launch_command
    simple_launcher(args)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\Python310\lib\site-packages\accelerate\commands\launch.py", line 795, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['D:\\Ganu\\AIImage\\huggingface\\kohya_ss\\Python310\\python.exe', 'train_network.py', '--config_file', 'D:\\Ganu\\AIImage\\project\\Train-10Images-0Parameters-14thApril2025\\models\\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\\config_lora-20250403-132700.toml']' returned non-zero exit status 1.
Error occurred while running the training script: Command '['accelerate', 'launch', 'train_network.py', '--config_file', 'D:\\Ganu\\AIImage\\project\\Train-10Images-0Parameters-14thApril2025\\models\\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\\config_lora-20250403-132700.toml']' returned non-zero exit status 1.

Can you please help?

Thank You

1 Like

Try official CLI.

Hello

I am getting the following error while running:

Error

python D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\code\train_lora.py

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.2.4 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\code\train_lora.py", line 9, in <module>
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\xformers\__init__.py", line 9, in <module>
    import torch
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\__init__.py", line 1382, in <module>
    from .functional import *  # noqa: F403
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\functional.py", line 7, in <module>
    import torch.nn.functional as F
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\__init__.py", line 1, in <module>
    from .modules import *  # noqa: F403
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\modules\__init__.py", line 35, in <module>
    from .transformer import TransformerEncoder, TransformerDecoder, \
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\modules\transformer.py", line 20, in <module>
    device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\modules\transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:84.)
  device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
?? Launching Kohya training with: D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\models\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\config_lora-20250403-132700.toml (CPU only)

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.2.4 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "D:\Ganu\AIImage\huggingface\kohya_ss\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\Ganu\AIImage\huggingface\kohya_ss\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\Scripts\accelerate.exe\__main__.py", line 4, in <module>
    from accelerate.commands.accelerate_cli import main
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\accelerate\__init__.py", line 16, in <module>
    from .accelerator import Accelerator
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\accelerate\accelerator.py", line 32, in <module>
    import torch
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\__init__.py", line 1382, in <module>
    from .functional import *  # noqa: F403
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\functional.py", line 7, in <module>
    import torch.nn.functional as F
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\__init__.py", line 1, in <module>
    from .modules import *  # noqa: F403
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\modules\__init__.py", line 35, in <module>
    from .transformer import TransformerEncoder, TransformerDecoder, \
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\modules\transformer.py", line 20, in <module>
    device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\modules\transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:84.)
  device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.2.4 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\sdxl_train_network.py", line 3, in <module>
    import torch
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\__init__.py", line 1382, in <module>
    from .functional import *  # noqa: F403
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\functional.py", line 7, in <module>
    import torch.nn.functional as F
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\__init__.py", line 1, in <module>
    from .modules import *  # noqa: F403
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\modules\__init__.py", line 35, in <module>
    from .transformer import TransformerEncoder, TransformerDecoder, \
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\modules\transformer.py", line 20, in <module>
    device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\nn\modules\transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:84.)
  device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
A matching Triton is not available, some optimizations will not be enabled.
Error caught was: No module named 'triton'
2025-04-14 14:13:37 INFO     Loading settings from                                                                                                                                               train_util.py:4012
                             D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\models\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\config_lora-20250403-132700.toml
                             ...
                    INFO     D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\models\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\config_lora-20250403-132700      train_util.py:4031
2025-04-14 14:13:37 INFO     prepare tokenizers                                                                                                                                              sdxl_train_util.py:138
D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\transformers\tokenization_utils_base.py:1601: FutureWarning: `clean_up_tokenization_spaces` was not set. It will be set to `True` by default. This behavior will be depracted in transformers v4.45, and will be then set to `False` by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884
  warnings.warn(
2025-04-14 14:13:38 INFO     update token length: 75                                                                                                                                         sdxl_train_util.py:163
                    INFO     Using DreamBooth method.                                                                                                                                          train_network.py:172
                    INFO     prepare images.                                                                                                                                                     train_util.py:1686
                    INFO     found directory D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\trained-model\img\40_10Images 0Parameters contains 10 image files                                     train_util.py:1633
                    INFO     400 train images with repeating.                                                                                                                                    train_util.py:1727
                    INFO     0 reg images.                                                                                                                                                       train_util.py:1730
                    WARNING  no regularization images / 正則化画像が見つかりませんでした                                                                                                         train_util.py:1735
                    INFO     [Dataset 0]                                                                                                                                                         config_util.py:572
                               batch_size: 1
                               resolution: (512, 512)
                               enable_bucket: True
                               network_multiplier: 1.0
                               min_bucket_reso: 256
                               max_bucket_reso: 2048
                               bucket_reso_steps: 64
                               bucket_no_upscale: True

                               [Subset 0 of Dataset 0]
                                 image_dir: "D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\trained-model\img\40_10Images 0Parameters"
                                 image_count: 10
                                 num_repeats: 40
                                 shuffle_caption: False
                                 keep_tokens: 0
                                 keep_tokens_separator:
                                 caption_separator: ,
                                 secondary_separator: None
                                 enable_wildcard: False
                                 caption_dropout_rate: 0.0
                                 caption_dropout_every_n_epoches: 0
                                 caption_tag_dropout_rate: 0.0
                                 caption_prefix: None
                                 caption_suffix: None
                                 color_aug: False
                                 flip_aug: False
                                 face_crop_aug_range: None
                                 random_crop: False
                                 token_warmup_min: 1,
                                 token_warmup_step: 0,
                                 alpha_mask: False,
                                 is_reg: False
                                 class_tokens: 10Images 0Parameters
                                 caption_extension: .txt


                    INFO     [Dataset 0]                                                                                                                                                         config_util.py:578
                    INFO     loading image sizes.                                                                                                                                                 train_util.py:901
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 556.64it/s]
                    INFO     make buckets                                                                                                                                                         train_util.py:907
                    WARNING  min_bucket_reso and max_bucket_reso are ignored if bucket_no_upscale is set, because bucket reso is defined by image size automatically /                            train_util.py:924
                             bucket_no_upscaleが指定された場合は、bucketの解像度は画像サイズから自動計算されるため、min_bucket_resoとmax_bucket_resoは無視されます
                    INFO     number of images (including repeats) / 各bucketの画像枚数(繰り返し回数を含む)                                                                                      train_util.py:953
                    INFO     bucket 0: resolution (704, 320), count: 400                                                                                                                          train_util.py:958
                    INFO     mean ar error (without repeats): 0.09826218809406236                                                                                                                 train_util.py:963
                    WARNING  clip_skip will be unexpected / SDXL学習ではclip_skipは動作しません                                                                                              sdxl_train_util.py:350
                    INFO     preparing accelerator                                                                                                                                             train_network.py:225
accelerator device: cuda
                    INFO     loading model for process 0/1                                                                                                                                    sdxl_train_util.py:33
                    INFO     load Diffusers pretrained models: stabilityai/stable-diffusion-xl-base-1.0, variant=fp16                                                                         sdxl_train_util.py:88
D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\huggingface_hub\file_download.py:1150: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
Loading pipeline components...:  67%|███████████████████████████████████████████████████████████████████████████████████████████████▎                                               | 4/6 [00:11<00:05,  2.81s/it]
Traceback (most recent call last):
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\sdxl_train_network.py", line 184, in <module>
    trainer.train(args)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\train_network.py", line 234, in train
    model_version, text_encoder, vae, unet = self.load_target_model(args, weight_dtype, accelerator)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\sdxl_train_network.py", line 43, in load_target_model
    ) = sdxl_train_util.load_target_model(args, accelerator, sdxl_model_util.MODEL_VERSION_SDXL_BASE_V1_0, weight_dtype)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\library\sdxl_train_util.py", line 43, in load_target_model
    ) = _load_target_model(
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\library\sdxl_train_util.py", line 91, in _load_target_model
    pipe = StableDiffusionXLPipeline.from_pretrained(
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\huggingface_hub\utils\_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1271, in from_pretrained
    loaded_sub_model = load_sub_model(
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 525, in load_sub_model
    loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\huggingface_hub\utils\_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\diffusers\schedulers\scheduling_utils.py", line 149, in from_pretrained
    return cls.from_config(config, return_unused_kwargs=return_unused_kwargs, **kwargs)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\diffusers\configuration_utils.py", line 259, in from_config
    model = cls(**init_dict)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\diffusers\configuration_utils.py", line 649, in inner_init
    init(self, *args, **init_kwargs)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\diffusers\schedulers\scheduling_euler_discrete.py", line 219, in __init__
    sigmas = np.array(((1 - self.alphas_cumprod) / self.alphas_cumprod) ** 0.5)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\torch\_tensor.py", line 1030, in __array__
    return self.numpy()
RuntimeError: Numpy is not available
Traceback (most recent call last):
  File "D:\Ganu\AIImage\huggingface\kohya_ss\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\Ganu\AIImage\huggingface\kohya_ss\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\Scripts\accelerate.exe\__main__.py", line 7, in <module>
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\accelerate\commands\accelerate_cli.py", line 46, in main
    args.func(args)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\accelerate\commands\launch.py", line 1082, in launch_command
    simple_launcher(args)
  File "D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\accelerate\commands\launch.py", line 688, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['D:\\Ganu\\AIImage\\huggingface\\kohya_ss\\sd-scripts\\venv\\Scripts\\python.exe', 'sdxl_train_network.py', '--config_file', 'D:\\Ganu\\AIImage\\project\\Train-10Images-0Parameters-14thApril2025\\models\\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\\config_lora-20250403-132700.toml']' returned non-zero exit status 1.
Error occurred while running the training script: Command '['accelerate', 'launch', 'sdxl_train_network.py', '--config_file', 'D:\\Ganu\\AIImage\\project\\Train-10Images-0Parameters-14thApril2025\\models\\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\\config_lora-20250403-132700.toml']' returned non-zero exit status 1.
1 Like

Hmm… Try:

pip install numpy<2

Works, but i am getting some different errors now:


[2025-04-14 14:37:57,450] [INFO] [real_accelerator.py:239:get_accelerator] Setting ds_accelerator to cuda (auto detect)
test.c
LINK : fatal error LNK1181: cannot open input file ‘aio.lib’
test.c
LINK : fatal error LNK1181: cannot open input file ‘cufile.lib’



A matching Triton is not available, some optimizations will not be enabled.
Error caught was: No module named ‘triton’


The exact run is below:

python D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\code\train_lora.py
?? Launching Kohya training with: D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\models\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\config_lora-20250403-132700.toml (CPU only)
**A matching Triton is not available, some optimizations will not be enabled.**
**Error caught was: No module named 'triton'**
2025-04-14 14:35:43 INFO     Loading settings from                                                                                                                                               train_util.py:4012
                             D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\models\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\config_lora-20250403-132700.toml
                             ...
2025-04-14 14:35:44 INFO     D:\Ganu\AIImage\project\Train-10Images-0Parameters-14thApril2025\models\lora_stabilityaistable-diffusion-xl-base-1.0_14thApril2025\config_lora-20250403-132700      train_util.py:4031
2025-04-14 14:35:44 INFO     prepare tokenizers                                                                                                                                              sdxl_train_util.py:138
D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\transformers\tokenization_utils_base.py:1601: FutureWarning: `clean_up_tokenization_spaces` was not set. It will be set to `True` by default. This behavior will be depracted in transformers v4.45, and will be then set to `False` by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884
  warnings.warn(
2025-04-14 14:35:45 INFO     update token length: 75                                                                                                                                         sdxl_train_util.py:163
                    INFO     Using DreamBooth method.                                                                                                                                          train_network.py:172
                    INFO     prepare images.                                                                                                                                                     train_util.py:1686
                    INFO     found directory D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\trained-model\img\40_10Images 0Parameters contains 10 image files                                     train_util.py:1633
                    INFO     400 train images with repeating.                                                                                                                                    train_util.py:1727
                    INFO     0 reg images.                                                                                                                                                       train_util.py:1730
                    WARNING  no regularization images / 正則化画像が見つかりませんでした                                                                                                         train_util.py:1735
                    INFO     [Dataset 0]                                                                                                                                                         config_util.py:572
                               batch_size: 1
                               resolution: (512, 512)
                               enable_bucket: True
                               network_multiplier: 1.0
                               min_bucket_reso: 256
                               max_bucket_reso: 2048
                               bucket_reso_steps: 64
                               bucket_no_upscale: True

                               [Subset 0 of Dataset 0]
                                 image_dir: "D:\Ganu\AIImage\huggingface\kohya_ss\kohya_ss\trained-model\img\40_10Images 0Parameters"
                                 image_count: 10
                                 num_repeats: 40
                                 shuffle_caption: False
                                 keep_tokens: 0
                                 keep_tokens_separator:
                                 caption_separator: ,
                                 secondary_separator: None
                                 enable_wildcard: False
                                 caption_dropout_rate: 0.0
                                 caption_dropout_every_n_epoches: 0
                                 caption_tag_dropout_rate: 0.0
                                 caption_prefix: None
                                 caption_suffix: None
                                 color_aug: False
                                 flip_aug: False
                                 face_crop_aug_range: None
                                 random_crop: False
                                 token_warmup_min: 1,
                                 token_warmup_step: 0,
                                 alpha_mask: False,
                                 is_reg: False
                                 class_tokens: 10Images 0Parameters
                                 caption_extension: .txt


                    INFO     [Dataset 0]                                                                                                                                                         config_util.py:578
                    INFO     loading image sizes.                                                                                                                                                 train_util.py:901
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 5000.96it/s]
                    INFO     make buckets                                                                                                                                                         train_util.py:907
                    WARNING  min_bucket_reso and max_bucket_reso are ignored if bucket_no_upscale is set, because bucket reso is defined by image size automatically /                            train_util.py:924
                             bucket_no_upscaleが指定された場合は、bucketの解像度は画像サイズから自動計算されるため、min_bucket_resoとmax_bucket_resoは無視されます
                    INFO     number of images (including repeats) / 各bucketの画像枚数(繰り返し回数を含む)                                                                                      train_util.py:953
                    INFO     bucket 0: resolution (704, 320), count: 400                                                                                                                          train_util.py:958
                    INFO     mean ar error (without repeats): 0.09826218809406236                                                                                                                 train_util.py:963
                    WARNING  clip_skip will be unexpected / SDXL学習ではclip_skipは動作しません                                                                                              sdxl_train_util.py:350
                    INFO     preparing accelerator                                                                                                                                             train_network.py:225
accelerator device: cuda
                    INFO     loading model for process 0/1                                                                                                                                    sdxl_train_util.py:33
                    INFO     load Diffusers pretrained models: stabilityai/stable-diffusion-xl-base-1.0, variant=fp16                                                                         sdxl_train_util.py:88
D:\Ganu\AIImage\huggingface\kohya_ss\sd-scripts\venv\lib\site-packages\huggingface_hub\file_download.py:1150: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
Loading pipeline components...: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6/6 [00:55<00:00,  9.31s/it]
2025-04-14 14:36:42 INFO     U-Net converted to original U-Net                                                                                                                               sdxl_train_util.py:124
                    INFO     Enable xformers for U-Net                                                                                                                                           train_util.py:2832
import network module: networks.lora
2025-04-14 14:36:48 INFO     [Dataset 0]                                                                                                                                                         train_util.py:2195
                    INFO     caching latents.                                                                                                                                                    train_util.py:1022
                    INFO     checking cache validity...                                                                                                                                          train_util.py:1049
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<?, ?it/s]
                    INFO     caching latents...                                                                                                                                                  train_util.py:1091
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:09<00:00,  1.04it/s]
2025-04-14 14:37:07 INFO     create LoRA network. base dim (rank): 64, alpha: 1                                                                                                                         lora.py:935
                    INFO     neuron dropout: p=None, rank dropout: p=None, module dropout: p=None                                                                                                       lora.py:936
                    INFO     create LoRA for Text Encoder 1:                                                                                                                                           lora.py:1027
2025-04-14 14:37:08 INFO     create LoRA for Text Encoder 2:                                                                                                                                           lora.py:1027
                    INFO     create LoRA for Text Encoder: 264 modules.                                                                                                                                lora.py:1035
2025-04-14 14:37:09 INFO     create LoRA for U-Net: 722 modules.                                                                                                                                       lora.py:1043
                    INFO     enable LoRA for text encoder: 264 modules                                                                                                                                 lora.py:1084
                    INFO     enable LoRA for U-Net: 722 modules                                                                                                                                        lora.py:1089
prepare optimizer, data loader etc.
2025-04-14 14:37:10 INFO     use 8-bit AdamW optimizer | {}                                                                                                                                      train_util.py:4166
[2025-04-14 14:37:57,450] [INFO] [real_accelerator.py:239:get_accelerator] Setting ds_accelerator to cuda (auto detect)
**test.c**
**LINK : fatal error LNK1181: cannot open input file 'aio.lib'**
**test.c**
LINK : fatal error LNK1181: cannot open input file 'cufile.lib'
2025-04-14 14:38:02 INFO     "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program               spawn.py:77
                             Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include" "-IC:\Program Files\Microsoft Visual
                             Studio\2022\Community\VC\Tools\MSVC\14.43.34808\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files
                             (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows
                             Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows
                             Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /TcC:\Users\ADMIN\AppData\Local\Temp\tmpd7l22yl_\test.c
                             /FoC:\Users\ADMIN\AppData\Local\Temp\tmpd7l22yl_\test.obj
--- Logging error ---
2025-04-14 14:38:02 INFO     "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program               spawn.py:77
                             Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include" "-IC:\Program Files\Microsoft Visual
                             Studio\2022\Community\VC\Tools\MSVC\14.43.34808\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files
                             (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows
                             Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows
                             Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /TcC:\Users\ADMIN\AppData\Local\Temp\tmpd7l22yl_\test.c
                             /FoC:\Users\ADMIN\AppData\Local\Temp\tmpd7l22yl_\test.obj
                    INFO     "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /MANIFEST:EMBED,ID=1            spawn.py:77
                             "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual
                             Studio\2022\Community\VC\Tools\MSVC\14.43.34808\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows
                             Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" aio.lib
                             C:\Users\ADMIN\AppData\Local\Temp\tmpd7l22yl_\test.obj /OUT:C:\Users\ADMIN\AppData\Local\Temp\tmpd7l22yl_\a.out.exe
--- Logging error ---
--- Logging error ---
--- Logging error ---
[2025-04-14 14:38:08,109] torch.distributed.elastic.multiprocessing.redirects: [WARNING] NOTE: Redirects are currently not supported in Windows or MacOs.
running training / 学習開始
  num train images * repeats / 学習画像の数×繰り返し回数: 400
  num reg images / 正則化画像の数: 0
  num batches per epoch / 1epochのバッチ数: 400
  num epochs / epoch数: 4
  batch size per device / バッチサイズ: 1
  gradient accumulation steps / 勾配を合計するステップ数 = 1
  total optimization steps / 学習ステップ数: 1600
steps:   0%|                                                                                                                                                                             | 0/1600 [00:00<?, ?it/s]
epoch 1/4
2025-04-14 14:38:02 INFO     "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program               spawn.py:77
                             Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include" "-IC:\Program Files\Microsoft Visual
                             Studio\2022\Community\VC\Tools\MSVC\14.43.34808\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files
                             (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows
                             Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows
                             Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /TcC:\Users\ADMIN\AppData\Local\Temp\tmpd7l22yl_\test.c
                             /FoC:\Users\ADMIN\AppData\Local\Temp\tmpd7l22yl_\test.obj
                    INFO     "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /MANIFEST:EMBED,ID=1            spawn.py:77
                             "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual
                             Studio\2022\Community\VC\Tools\MSVC\14.43.34808\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows
                             Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" aio.lib
                             C:\Users\ADMIN\AppData\Local\Temp\tmpd7l22yl_\test.obj /OUT:C:\Users\ADMIN\AppData\Local\Temp\tmpd7l22yl_\a.out.exe
2025-04-14 14:38:07 INFO     "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program               spawn.py:77
                             Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include" "-IC:\Program Files\Microsoft Visual
                             Studio\2022\Community\VC\Tools\MSVC\14.43.34808\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files
                             (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows
                             Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows
                             Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /TcC:\Users\ADMIN\AppData\Local\Temp\tmpo2wnsev3\test.c
                             /FoC:\Users\ADMIN\AppData\Local\Temp\tmpo2wnsev3\test.obj
                    INFO     "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /MANIFEST:EMBED,ID=1            spawn.py:77
                             "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6" "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\lib64" "/LIBPATH:C:\Program
                             Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual
                             Studio\2022\Community\VC\Tools\MSVC\14.43.34808\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows
                             Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" cufile.lib
                             C:\Users\ADMIN\AppData\Local\Temp\tmpo2wnsev3\test.obj /OUT:C:\Users\ADMIN\AppData\Local\Temp\tmpo2wnsev3\a.out.exe
2025-04-14 14:38:09 INFO     epoch is incremented. current_epoch: 0, epoch: 1                                                                                                                     train_util.py:693
steps:   0%|▎     
1 Like

A matching Triton is not available, some optimizations will not be enabled.
Error caught was: No module named ‘triton’

This is unavoidable in a Windows environment, so just ignore it. The other error is the problem.

LINK : fatal error LNK1181: cannot open input file ‘aio.lib’

It seems to be an error related to DeepSpeed, so I think you can get through it if you can turn DeepSpeed off.

I did turn DeepSpeed off, but still getting the error:

[2025-04-14 15:06:55,008] [INFO] [real_accelerator.py:239:get_accelerator] Setting ds_accelerator to cuda (auto detect)
test.c
LINK : fatal error LNK1181: cannot open input file ‘aio.lib’
test.c
LINK : fatal error LNK1181: cannot open input file ‘cufile.lib’

1 Like

I think something that is probably a prerequisite is not installed…
like the CUDA Toolkit?