kohya_ss icon indicating copy to clipboard operation
kohya_ss copied to clipboard

looks like the code can't handle spaces?

Open alectprasad opened this issue 1 year ago • 5 comments

train_data: /content/LoRA/train_data/10_jennifer aniston person project name: jennifer aniston

train_network.py: error: unrecognized arguments: aniston aniston
Traceback (most recent call last):
  File "/usr/local/bin/accelerate", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/accelerate/commands/accelerate_cli.py", line 45, in main
    args.func(args)
  File "/usr/local/lib/python3.8/dist-packages/accelerate/commands/launch.py", line 1104, in launch_command
    simple_launcher(args)
  File "/usr/local/lib/python3.8/dist-packages/accelerate/commands/launch.py", line 567, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', 'train_network.py', '--output_name=jennifer', 'aniston', '--pretrained_model_name_or_path=/content/pretrained_model/Stable-Diffusion-v1-5.safetensors', '--train_data_dir=/content/LoRA/train_data', '--reg_data_dir=/content/LoRA/reg_data', '--output_dir=/content/LoRA/output', '--network_dim=128', '--network_alpha=128', '--network_module=networks.lora', '--optimizer_type=AdamW8bit', '--learning_rate=0.0001', '--unet_lr=0.0001', '--text_encoder_lr=5e-05', '--lr_scheduler=constant', '--resolution=512', '--cache_latents', '--caption_extension=.caption', '--prior_loss_weight=1.0', '--lowram', '--train_batch_size=6', '--max_train_epochs=20', '--mixed_precision=fp16', '--save_precision=fp16', '--save_n_epoch_ratio=3', '--save_model_as=safetensors', '--max_token_length=225', '--gradient_accumulation_steps=1', '--clip_skip=2', '--logging_dir=/content/LoRA/logs', '--log_prefix=jennifer', 'aniston', '--shuffle_caption', '--xformers']' returned non-zero exit status 2.

alectprasad avatar Mar 03 '23 08:03 alectprasad

Let me try to reproduce this scenario...

bmaltais avatar Mar 03 '23 12:03 bmaltais

I just tried to reproduce and all worked fine. Are you using the latest update of the project?

bmaltais avatar Mar 03 '23 12:03 bmaltais

this is the latest colab https://colab.research.google.com/github/Linaqruf/kohya-trainer/blob/main/kohya-LoRA-dreambooth.ipynb

alectprasad avatar Mar 03 '23 12:03 alectprasad

Oh... this is in a colab? I only test the solution locally on windows. It is possible the colab is not pulling the latest version... Yeah... that colab does not use my GUI code... you should ask the colab creator... he might be using the new code base from sd-script that was updated yesterday. Kohya mentionned it is a huge change and possible causing some issues... perhaps this is one of those.

bmaltais avatar Mar 03 '23 13:03 bmaltais

No it cant, close the space in the file manager and it works the same

G-force78 avatar Mar 05 '23 12:03 G-force78

Ran into this as well and am running on the latest source, I think paths are not escaped or at least quoted to prevent arguments split when calling various scripts.

I.e. here I'm trying to resize a LoRA:

./venv/Scripts/python.exe "networks\resize_lora.py" --save_precision fp16 --save_to K:/My Drive/stablediff/trained_output/lora_v2_rank4.safetensors --model K:/My Drive/stablediff/trained_output/lora.safetensors --new_rank 4 --device cuda --dynamic_method sv_fro --dynamic_param 0.9 usage: resize_lora.py [-h] [--save_precision {None,float,fp16,bf16}] [--new_rank NEW_RANK] [--save_to SAVE_TO] [--model MODEL] [--device DEVICE] [--verbose] [--dynamic_method {None,sv_ratio,sv_fro,sv_cumulative}] [--dynamic_param DYNAMIC_PARAM] resize_lora.py: error: unrecognized arguments: Drive/stablediff/trained_output/lora_v2_rank4.safetensors Drive/stablediff/trained_output/lora.safetensors

I've tried using quotes when giving the file path but then the GUI complains that the specified path is not a file.

adrianlungu avatar Apr 01 '23 20:04 adrianlungu