huggingface / autotrain-advanced

🤗 AutoTrain Advanced
https://huggingface.co/autotrain
Apache License 2.0
3.99k stars 487 forks source link

Dreambooth LoRa accepts Non Squared images? #174

Closed if-ai closed 1 year ago

if-ai commented 1 year ago

I have been trying to use this repo, but it fails. Does this repo support non-squared images?

Also, I think this might be the same reason the project fails to run on The HF auto train also. If is not supported, could please add the non-squared images support?

Thanks,

abhishekkrthakur commented 1 year ago

what command have you been running?

if-ai commented 1 year ago

autotrain dreambooth --model /mnt/e/automatic/models/Stable-diffusion/sd_xl_base_1.0.safetensors --output /mnt/e/autotrain/model --image-path /mnt/e/autotrain/datset --resolution 1024 --batch-size 1 --num-steps 500 --fp16 --gradient-accumulation 4 --lr 1e-4 --prompt "sksSafiro" Wow that is a fast response also is --prompt "sksSafiro" the same as concept on the autotrain interface. I can't find another command using --help

abhishekkrthakur commented 1 year ago

Are you using the UI? Or command line? The images get resized internally, so all kinds of sizes are supported. Do you get any error? Could you share the logs or error please?

if-ai commented 1 year ago

I am running CLI on my computer after trying HF

 (autotrain-env) impactframes@DESKTOP-E9ECR1J:/mnt/e/autotrain$ autotrain dreambooth --model /mnt/e/automatic/models/Stable-diffusion/sd_xl_base_1.0.safetensors --output /mnt/e/autotrain/model --image-path /mnt/e/autotrain/datset --resolution 1024 --batch-size 1 --num-steps 500 --fp16 --gradient-accumulation 4 --lr 1e-4 --prompt "sksSafiro"
2023-07-29 10:09:00.479 | WARNING  | autotrain.cli.run_dreambooth:<module>:15 - ❌ Some DreamBooth components are missing! Please run `autotrain setup` to install it. Ignore this warning if you are not using DreamBooth or running `autotrain setup` already.
2023-07-29 10:09:17.555 | INFO     | autotrain.cli.run_dreambooth:__init__:423 - Namespace(version=False, model='/mnt/e/automatic/models/Stable-diffusion/sd_xl_base_1.0.safetensors', revision=None, tokenizer=None, image_path='/mnt/e/autotrain/datset', class_image_path=None, prompt='sksSafiro', class_prompt=None, num_class_images=100, class_labels_conditioning=None, prior_preservation=None, prior_loss_weight=1.0, output='/mnt/e/autotrain/model', seed=42, resolution=1024, center_crop=None, train_text_encoder=None, batch_size=1, sample_batch_size=4, epochs=1, num_steps=500, checkpointing_steps=500, resume_from_checkpoint=None, gradient_accumulation=4, gradient_checkpointing=None, lr=0.0001, scale_lr=None, scheduler='constant', warmup_steps=0, num_cycles=1, lr_power=1.0, dataloader_num_workers=0, use_8bit_adam=None, adam_beta1=0.9, adam_beta2=0.999, adam_weight_decay=0.01, adam_epsilon=1e-08, max_grad_norm=1.0, allow_tf32=None, prior_generation_precision=None, local_rank=-1, xformers=None, pre_compute_text_embeddings=None, tokenizer_max_length=None, text_encoder_use_attention_mask=None, rank=4, xl=None, fp16=True, bf16=None, hub_token=None, hub_model_id=None, push_to_hub=None, validation_prompt=None, num_validation_images=4, validation_epochs=50, checkpoints_total_limit=None, validation_images=None, logging=None, func=<function run_dreambooth_command_factory at 0x7f892a84b130>)
Traceback (most recent call last):
  File "/mnt/e/autotrain/autotrain-env/bin/autotrain", line 8, in <module>
    sys.exit(main())
  File "/mnt/e/autotrain/autotrain-env/lib/python3.10/site-packages/autotrain/cli/autotrain.py", line 35, in main
    command = args.func(args)
  File "/mnt/e/autotrain/autotrain-env/lib/python3.10/site-packages/autotrain/cli/run_dreambooth.py", line 28, in run_dreambooth_command_factory
    return RunAutoTrainDreamboothCommand(args)
  File "/mnt/e/autotrain/autotrain-env/lib/python3.10/site-packages/autotrain/cli/run_dreambooth.py", line 452, in __init__
    raise ValueError("❌ Please specify a valid image directory")
ValueError: ❌ Please specify a valid image directory
(autotrain-env) impactframes@DESKTOP-E9ECR1J:/mnt/e/autotrain$ 

On HF I didn't had error but I got charged for two projects that failed haha

msedge_kmEBc198jD msedge_OyvrdDeaEL msedge_UGLLFi5pz6

abhishekkrthakur commented 1 year ago

It seems like you dont have valid images: jpeg, jpg or png in your dataset directory. Could you please check that directory consists of valid image files?

Regarding the failed trainings on ui, please drop a note to autotrain@hf.co with your username and affected project names and charges will be reversed. The UI currently doesnt support sdxl tuning if you select 'hugging face internal' as backend. It is supported on 'hugging face spaces' backend.

if-ai commented 1 year ago

Yes there are .png images on that folder explorer_P6IrZYquUW Perhaps the names are too long? for example close up of safiro_keiji, beauty face expression, purple collar, pompadour hairstyle, 3d animated cartoon, style of impactframes.png I will change them and try once more. Also thank you for the HF link I will contact them regarding the charges

abhishekkrthakur commented 1 year ago

do you have dot . in names? that might be messing up with extension checks. the images look fine to me, so im not sure why you will get the error. however, i will recommend renaming the images, if not a lot of work and then give it a go again. if you can share the images, i can also try on my end.

if-ai commented 1 year ago

I had the same error after renaming. Maybe I have some other error on my installation I followed all the instructions, but I will spin a lambda instance and try again. Thank you for all your help