ShivamShrirao / diffusers

🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in PyTorch
https://huggingface.co/docs/diffusers
Apache License 2.0
1.88k stars 506 forks source link

cant find stable-diffusion-v1-4 when running in terminal #43

Open gozi1123 opened 2 years ago

gozi1123 commented 2 years ago

Describe the bug

When running the training script via terminal (ubuntu 18.04) I get an error

train_booth.sh: line 5: --pretrained_model_name_or_path=CompVis/stable-diffusion-v1-4: No such file or directory

This doesn't happen when running the script in Pycharm

Reproduction

accelerate launch train_dreambooth.py \ --pretrained_model_name_or_path="CompVis/stable-diffusion-v1-4" \ --instance_data_dir="PATH" \ --class_data_dir="woman" \ --output_dir="PATH" \ --with_prior_preservation --prior_loss_weight=1.0 \ --instance_prompt="propt" \ --class_prompt="photo of a woman" \ --seed=1337 \ --resolution=512 \ --train_batch_size=1 \ --mixed_precision="fp16" \ --use_8bit_adam \ --gradient_accumulation_steps=1 \ --learning_rate=5e-6 \ --lr_scheduler="constant" \ --lr_warmup_steps=0 \ --num_class_images=50 \ --sample_batch_size=4 \ --max_train_steps=1000 \ --gradient_checkpointing

Logs

CUDA_VISIBLE_DEVICES=1 bash train_booth.sh
The following values were not passed to `accelerate launch` and had defaults used instead:
    `--num_cpu_threads_per_process` was set to `8` to improve out-of-box performance
To avoid this warning pass in values for each of the problematic parameters or run `accelerate config`.
usage: train_dreambooth.py [-h] --pretrained_model_name_or_path PRETRAINED_MODEL_NAME_OR_PATH [--tokenizer_name TOKENIZER_NAME] --instance_data_dir INSTANCE_DATA_DIR [--class_data_dir CLASS_DATA_DIR]
                           [--instance_prompt INSTANCE_PROMPT] [--class_prompt CLASS_PROMPT] [--with_prior_preservation] [--prior_loss_weight PRIOR_LOSS_WEIGHT] [--num_class_images NUM_CLASS_IMAGES] [--output_dir OUTPUT_DIR]
                           [--seed SEED] [--resolution RESOLUTION] [--center_crop] [--train_batch_size TRAIN_BATCH_SIZE] [--sample_batch_size SAMPLE_BATCH_SIZE] [--num_train_epochs NUM_TRAIN_EPOCHS]
                           [--max_train_steps MAX_TRAIN_STEPS] [--gradient_accumulation_steps GRADIENT_ACCUMULATION_STEPS] [--gradient_checkpointing] [--learning_rate LEARNING_RATE] [--scale_lr] [--lr_scheduler LR_SCHEDULER]
                           [--lr_warmup_steps LR_WARMUP_STEPS] [--use_8bit_adam] [--adam_beta1 ADAM_BETA1] [--adam_beta2 ADAM_BETA2] [--adam_weight_decay ADAM_WEIGHT_DECAY] [--adam_epsilon ADAM_EPSILON]
                           [--max_grad_norm MAX_GRAD_NORM] [--push_to_hub] [--hub_token HUB_TOKEN] [--hub_model_id HUB_MODEL_ID] [--logging_dir LOGGING_DIR] [--log_interval LOG_INTERVAL] [--mixed_precision {no,fp16,bf16}]
                           [--not_cache_latents] [--local_rank LOCAL_RANK]
train_dreambooth.py: error: the following arguments are required: --pretrained_model_name_or_path, --instance_data_dir
Traceback (most recent call last):
  File "/home/galgozes/anaconda3/envs/dbooth/bin/accelerate", line 8, in <module>
    sys.exit(main())
  File "/home/galgozes/anaconda3/envs/dbooth/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 43, in main
    args.func(args)
  File "/home/galgozes/anaconda3/envs/dbooth/lib/python3.10/site-packages/accelerate/commands/launch.py", line 837, in launch_command
    simple_launcher(args)
  File "/home/galgozes/anaconda3/envs/dbooth/lib/python3.10/site-packages/accelerate/commands/launch.py", line 354, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/home/galgozes/anaconda3/envs/dbooth/bin/python', 'train_dreambooth.py']' returned non-zero exit status 2.
train_booth.sh: line 5: --pretrained_model_name_or_path=CompVis/stable-diffusion-v1-4: No such file or directory

System Info

Campfirecrucifix commented 1 year ago

Not sure if you are still having this issue or not but here is what worked for me.

You need to change your end of line (EOL) from CRLF to LF in notepad ++. Here is a quote from google on how to do that: In Notepad++ go to the View > Show Symbol menu and select Show End of Line. Once you select View > Show Symbol > Show End of Line you can see the CR LF characters visually. You can then use the menu item Edit > EOL Conversion and select Unix (LF).

As soon as I did that and saved the file it was able to download the model for me.

Also my pretrained model path looks like this: --pretrained_model_name_or_path=$MODEL_NAME \

and at the top of the file export MODEL_NAME="CompVis/stable-diffusion-v1-4"

Hope that helps.