diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Error using dreambooth

Open EnricoBeltramo opened this issue 3 years ago • 1 comments

Describe the bug

Following the tutorial in notebook: https://github.com/huggingface/diffusers/tree/main/examples/dreambooth

with latest version of code I have follow error: ImportError: cannot import name 'ProjectConfiguration' from 'accelerate.utils'

With a previous commit (i.e. 1e7f96544203724652707dc93a7671c90efd3eeb) the error doesn't appear

Reproduction

in a notebook, first I do:

from accelerate.utils import write_basic_config write_basic_config()

after the command: !accelerate launch train_dreambooth.py
--pretrained_model_name_or_path="$MODEL_NAME"
--instance_data_dir="$INSTANCE_DIR"
--output_dir="$OUTPUT_DIR"
--instance_prompt="$PROMPT"
--resolution=$RESOLUTION
--train_batch_size=1
--learning_rate=$LEARNING_RATE
--lr_scheduler="constant"
--lr_warmup_steps=0
--max_train_steps=$NUM_STEPS
--gradient_accumulation_steps=2
--gradient_checkpointing
--use_8bit_adam
--checkpointing_steps=100000

Logs

/bin/bash: /opt/conda/lib/libtinfo.so.6: no version information available (required by /bin/bash)
Traceback (most recent call last):
  File "train_dreambooth.py", line 33, in <module>
    from accelerate.utils import ProjectConfiguration, set_seed
ImportError: cannot import name 'ProjectConfiguration' from 'accelerate.utils' (/opt/conda/lib/python3.7/site-packages/accelerate/utils/__init__.py)
Traceback (most recent call last):
  File "/opt/conda/bin/accelerate", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.7/site-packages/accelerate/commands/accelerate_cli.py", line 43, in main
    args.func(args)
  File "/opt/conda/lib/python3.7/site-packages/accelerate/commands/launch.py", line 837, in launch_command
    simple_launcher(args)
  File "/opt/conda/lib/python3.7/site-packages/accelerate/commands/launch.py", line 354, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/opt/conda/bin/python3.7', 'train_dreambooth.py', '--pretrained_model_name_or_path=stabilityai/stable-diffusion-2-1', '--instance_data_dir=/kaggle/input/100-bird-species/train/ABBOTTS BABBLER', '--output_dir=/kaggle/working/results', '--instance_prompt=ABBOTTS BABBLER, photography, realistic, color', '--resolution=768', '--train_batch_size=1', '--learning_rate=5e-06', '--lr_scheduler=constant', '--lr_warmup_steps=0', '--max_train_steps=400', '--gradient_accumulation_steps=1', '--gradient_checkpointing', '--use_8bit_adam', '--enable_xformers_memory_efficient_attention', '--set_grads_to_none', '--checkpointing_steps=100000']' returned non-zero exit status 1

System Info

Kaggle notebook,

  • diffusers version: 0.13.0.dev0
  • Platform: Linux-5.15.65+-x86_64-with-debian-bullseye-sid
  • Python version: 3.7.12
  • PyTorch version (GPU?): 1.13.1+cu116 (True)
  • Huggingface_hub version: 0.12.1
  • Transformers version: 4.26.1
  • Accelerate version: 0.12.0
  • xFormers version: 0.0.16
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?:

EnricoBeltramo avatar Feb 18 '23 13:02 EnricoBeltramo

Could you ensure you have the latest version of accelerate installed? Cc: @williamberman

sayakpaul avatar Feb 20 '23 07:02 sayakpaul

No, I had a previous version of accellerate. I updated to latest (0.16.0) and now all work correctly! thank you!

EnricoBeltramo avatar Feb 20 '23 22:02 EnricoBeltramo