kohya-ss / kohya-ss/sd-scripts
failed run kohya for training lora model
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.2k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
hello guys, i have an issue running the kohya, please someone give me a solution for this, thank you
this is the error message:

06:34:57-522654 INFO Start training LoRA Standard ...
06:34:57-524653 INFO Validating model file or folder path D:/Program
files/kohya/training/base/v1-5-pruned.safetensors existence...
06:34:57-525653 INFO ...valid
06:34:57-526652 INFO Validating output_dir path D:/Program files/kohya/training/lora_sdxl\model existence...
06:34:57-527653 INFO ...valid
06:34:57-528651 INFO Validating train_data_dir path D:/Program files/kohya/training/lora_sdxl\img existence...
06:34:57-528651 INFO ...valid
06:34:57-529651 INFO Validating reg_data_dir path D:/Program
files/kohya/stable-diffusion-regularization-images-main/demo/women/upscale existence...
06:34:57-530653 INFO ...valid
06:34:57-531663 INFO Validating logging_dir path D:/Program files/kohya/training/lora_sdxl\log existence...
06:34:57-531663 INFO ...valid
06:34:57-532652 INFO log_tracker_config not specified, skipping validation
06:34:57-533657 INFO resume not specified, skipping validation
06:34:57-533657 INFO vae not specified, skipping validation
06:34:57-534652 INFO lora_network_weights not specified, skipping validation
06:34:57-535655 INFO dataset_config not specified, skipping validation
06:34:57-537652 INFO Folder 40_4urel1emoeramans women: 40 images found
06:34:57-538677 INFO Folder 40_4urel1emoeramans women: 1600 steps
06:34:57-539664 WARNING Regularisation images are used... Will double the number of steps required...
06:34:57-540651 INFO Total steps: 1600
06:34:57-541656 INFO Train batch size: 8
06:34:57-542651 INFO Gradient accumulation steps: 3
06:34:57-544030 INFO Epoch: 10
06:34:57-544030 INFO Regulatization factor: 2
06:34:57-545035 INFO max_train_steps (1600 / 8 / 3 * 10 * 2) = 1334
06:34:57-546035 INFO stop_text_encoder_training = 0
06:34:57-547034 INFO lr_warmup_steps = 133
06:34:57-547034 INFO Can't use LR warmup with LR Scheduler constant... ignoring...
06:34:57-548035 INFO Saving training config to D:/Program
files/kohya/training/lora_sdxl\model\4urel1emoeramans_20240331-063457.json...
06:34:57-551035 INFO accelerate launch --num_cpu_threads_per_process=2 "D:\Program
files\kohya\kohya_ss/sd-scripts/train_network.py" --bucket_no_upscale --bucket_reso_steps=64
--cache_latents --cache_latents_to_disk --caption_extension=".txt" --clip_skip=2
--enable_bucket --min_bucket_reso=256 --max_bucket_reso=2048 --gradient_accumulation_steps=3
--gradient_checkpointing --learning_rate="0.0001" --logging_dir="D:/Program
files/kohya/training/lora_sdxl\log" --lr_scheduler="constant" --lr_scheduler_num_cycles="10"
--max_data_loader_n_workers="0" --max_grad_norm="1" --resolution=""768,768""
--max_train_steps="1334" --mem_eff_attn --mixed_precision="bf16" --network_alpha="1"
--network_dim=256 --network_module=networks.lora --optimizer_args --cache_text_encoder_outputs
--network_train_unet_only --bucket_reso_steps="32" --optimizer_type="AdamW8bit"
--output_dir="D:/Program files/kohya/training/lora_sdxl\model" --output_name="4urel1emoeramans"
--pretrained_model_name_or_path="D:/Program files/kohya/training/base/v1-5-pruned.safetensors"
--reg_data_dir="D:/Program
files/kohya/stable-diffusion-regularization-images-main/demo/women/upscale"
--save_every_n_epochs="1" --save_model_as=safetensors --save_precision="bf16"
--train_batch_size="8" --training_comment="4urel1emoeramans" --train_data_dir="D:/Program
files/kohya/training/lora_sdxl\img" --v_parameterization --v2 --xformers
A matching Triton is not available, some optimizations will not be enabled.
Error caught was: No module named 'triton'
usage: train_network.py [-h] [--console_log_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
[--console_log_file CONSOLE_LOG_FILE] [--console_log_simple] [--v2] [--v_parameterization]
[--pretrained_model_name_or_path PRETRAINED_MODEL_NAME_OR_PATH]
[--tokenizer_cache_dir TOKENIZER_CACHE_DIR] [--train_data_dir TRAIN_DATA_DIR]
[--shuffle_caption] [--caption_separator CAPTION_SEPARATOR]
[--caption_extension CAPTION_EXTENSION] [--caption_extention CAPTION_EXTENTION]
[--keep_tokens KEEP_TOKENS] [--keep_tokens_separator KEEP_TOKENS_SEPARATOR]
[--caption_prefix CAPTION_PREFIX] [--caption_suffix CAPTION_SUFFIX] [--color_aug] [--flip_aug]
[--face_crop_aug_range FACE_CROP_AUG_RANGE] [--random_crop] [--debug_dataset]
[--resolution RESOLUTION] [--cache_latents] [--vae_batch_size VAE_BATCH_SIZE]
[--cache_latents_to_disk] [--enable_bucket] [--min_bucket_reso MIN_BUCKET_RESO]
[--max_bucket_reso MAX_BUCKET_RESO] [--bucket_reso_steps BUCKET_RESO_STEPS]
[--bucket_no_upscale] [--token_warmup_min TOKEN_WARMUP_MIN]
[--token_warmup_step TOKEN_WARMUP_STEP] [--dataset_class DATASET_CLASS]
[--caption_dropout_rate CAPTION_DROPOUT_RATE]
[--caption_dropout_every_n_epochs CAPTION_DROPOUT_EVERY_N_EPOCHS]
[--caption_tag_dropout_rate CAPTION_TAG_DROPOUT_RATE] [--reg_data_dir REG_DATA_DIR]
[--in_json IN_JSON] [--dataset_repeats DATASET_REPEATS] [--output_dir OUTPUT_DIR]
[--output_name OUTPUT_NAME] [--huggingface_repo_id HUGGINGFACE_REPO_ID]
[--huggingface_repo_type HUGGINGFACE_REPO_TYPE]
[--huggingface_path_in_repo HUGGINGFACE_PATH_IN_REPO] [--huggingface_token HUGGINGFACE_TOKEN]
[--huggingface_repo_visibility HUGGINGFACE_REPO_VISIBILITY] [--save_state_to_huggingface]
[--resume_from_huggingface] [--async_upload] [--save_precision {None,float,fp16,bf16}]
[--save_every_n_epochs SAVE_EVERY_N_EPOCHS] [--save_every_n_steps SAVE_EVERY_N_STEPS]
[--save_n_epoch_ratio SAVE_N_EPOCH_RATIO] [--save_last_n_epochs SAVE_LAST_N_EPOCHS]
[--save_last_n_epochs_state SAVE_LAST_N_EPOCHS_STATE] [--save_last_n_steps SAVE_LAST_N_STEPS]
[--save_last_n_steps_state SAVE_LAST_N_STEPS_STATE] [--save_state] [--resume RESUME]
[--train_batch_size TRAIN_BATCH_SIZE] [--max_token_length {None,150,225}] [--mem_eff_attn]
[--torch_compile]
[--dynamo_backend {eager,aot_eager,inductor,aot_ts_nvfuser,nvprims_nvfuser,cudagraphs,ofi,fx2trt,onnxrt}]
[--xformers] [--sdpa] [--vae VAE] [--max_train_steps MAX_TRAIN_STEPS]
[--max_train_epochs MAX_TRAIN_EPOCHS] [--max_data_loader_n_workers MAX_DATA_LOADER_N_WORKERS]
[--persistent_data_loader_workers] [--seed SEED] [--gradient_checkpointing]
[--gradient_accumulation_steps GRADIENT_ACCUMULATION_STEPS] [--mixed_precision {no,fp16,bf16}]
[--full_fp16] [--full_bf16] [--fp8_base] [--ddp_timeout DDP_TIMEOUT]
[--ddp_gradient_as_bucket_view] [--ddp_static_graph] [--clip_skip CLIP_SKIP]
[--logging_dir LOGGING_DIR] [--log_with {tensorboard,wandb,all}] [--log_prefix LOG_PREFIX]
[--log_tracker_name LOG_TRACKER_NAME] [--wandb_run_name WANDB_RUN_NAME]
[--log_tracker_config LOG_TRACKER_CONFIG] [--wandb_api_key WANDB_API_KEY]
[--noise_offset NOISE_OFFSET] [--multires_noise_iterations MULTIRES_NOISE_ITERATIONS]
[--ip_noise_gamma IP_NOISE_GAMMA] [--multires_noise_discount MULTIRES_NOISE_DISCOUNT]
[--adaptive_noise_scale ADAPTIVE_NOISE_SCALE] [--zero_terminal_snr]
[--min_timestep MIN_TIMESTEP] [--max_timestep MAX_TIMESTEP] [--lowram] [--highvram]
[--sample_every_n_steps SAMPLE_EVERY_N_STEPS] [--sample_at_first]
[--sample_every_n_epochs SAMPLE_EVERY_N_EPOCHS] [--sample_prompts SAMPLE_PROMPTS]
[--sample_sampler {ddim,pndm,lms,euler,euler_a,heun,dpm_2,dpm_2_a,dpmsolver,dpmsolver++,dpmsingle,k_lms,k_euler,k_euler_a,k_dpm_2,k_dpm_2_a}]
[--config_file CONFIG_FILE] [--output_config] [--metadata_title METADATA_TITLE]
[--metadata_author METADATA_AUTHOR] [--metadata_description METADATA_DESCRIPTION]
[--metadata_license METADATA_LICENSE] [--metadata_tags METADATA_TAGS]
[--prior_loss_weight PRIOR_LOSS_WEIGHT] [--optimizer_type OPTIMIZER_TYPE] [--use_8bit_adam]
[--use_lion_optimizer] [--learning_rate LEARNING_RATE] [--max_grad_norm MAX_GRAD_NORM]
[--optimizer_args [OPTIMIZER_ARGS ...]] [--lr_scheduler_type LR_SCHEDULER_TYPE]
[--lr_scheduler_args [LR_SCHEDULER_ARGS ...]] [--lr_scheduler LR_SCHEDULER]
[--lr_warmup_steps LR_WARMUP_STEPS] [--lr_scheduler_num_cycles LR_SCHEDULER_NUM_CYCLES]
[--lr_scheduler_power LR_SCHEDULER_POWER] [--dataset_config DATASET_CONFIG]
[--min_snr_gamma MIN_SNR_GAMMA] [--scale_v_pred_loss_like_noise_pred]
[--v_pred_like_loss V_PRED_LIKE_LOSS] [--debiased_estimation_loss] [--weighted_captions]
[--no_metadata] [--save_model_as {None,ckpt,pt,safetensors}] [--unet_lr UNET_LR]
[--text_encoder_lr TEXT_ENCODER_LR] [--network_weights NETWORK_WEIGHTS]
[--network_module NETWORK_MODULE] [--network_dim NETWORK_DIM] [--network_alpha NETWORK_ALPHA]
[--network_dropout NETWORK_DROPOUT] [--network_args [NETWORK_ARGS ...]]
[--network_train_unet_only] [--network_train_text_encoder_only]
[--training_comment TRAINING_COMMENT] [--dim_from_weights]
[--scale_weight_norms SCALE_WEIGHT_NORMS] [--base_weights [BASE_WEIGHTS ...]]
[--base_weights_multiplier [BASE_WEIGHTS_MULTIPLIER ...]] [--no_half_vae]
train_network.py: error: unrecognized arguments: --cache_text_encoder_outputs
Traceback (most recent call last):
File "C:\Users\afifu\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\afifu\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\Program files\kohya\kohya_ss\venv\Scripts\accelerate.exe\__main__.py", line 7, in
File "D:\Program files\kohya\kohya_ss\venv\lib\site-packages\accelerate\commands\accelerate_cli.py", line 47, in main
args.func(args)
File "D:\Program files\kohya\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py", line 1017, in launch_command
simple_launcher(args)
File "D:\Program files\kohya\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py", line 637, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['D:\\Program files\\kohya\\kohya_ss\\venv\\Scripts\\python.exe', 'D:\\Program files\\kohya\\kohya_ss/sd-scripts/train_network.py', '--bucket_no_upscale', '--bucket_reso_steps=64', '--cache_latents', '--cache_latents_to_disk', '--caption_extension=.txt', '--clip_skip=2', '--enable_bucket', '--min_bucket_reso=256', '--max_bucket_reso=2048', '--gradient_accumulation_steps=3', '--gradient_checkpointing', '--learning_rate=0.0001', '--logging_dir=D:/Program files/kohya/training/lora_sdxl\\log', '--lr_scheduler=constant', '--lr_scheduler_num_cycles=10', '--max_data_loader_n_workers=0', '--max_grad_norm=1', '--resolution=768,768', '--max_train_steps=1334', '--mem_eff_attn', '--mixed_precision=bf16', '--network_alpha=1', '--network_dim=256', '--network_module=networks.lora', '--optimizer_args', '--cache_text_encoder_outputs', '--network_train_unet_only', '--bucket_reso_steps=32', '--optimizer_type=AdamW8bit', '--output_dir=D:/Program files/kohya/training/lora_sdxl\\model', '--output_name=4urel1emoeramans', '--pretrained_model_name_or_path=D:/Program files/kohya/training/base/v1-5-pruned.safetensors', '--reg_data_dir=D:/Program files/kohya/stable-diffusion-regularization-images-main/demo/women/upscale', '--save_every_n_epochs=1', '--save_model_as=safetensors', '--save_precision=bf16', '--train_batch_size=8', '--training_comment=4urel1emoeramans', '--train_data_dir=D:/Program files/kohya/training/lora_sdxl\\img', '--v_parameterization', '--v2', '--xformers']' returned non-zero exit status 2.
Contributor guide
No contributing guide indexed for this repository
Research direction
The report points to train_network.py and the generated accelerate command; begin by comparing the command's --cache_text_encoder_outputs option with the displayed usage output. Reproduce the Windows training invocation using the listed paths and configuration, then establish the expected command behavior and a verifiable resolution.
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
- 18/100