mkshing / e4t-diffusion

Implementation of Encoder-based Domain Tuning for Fast Personalization of Text-to-Image Models
https://arxiv.org/abs/2302.12228
MIT License
321 stars 24 forks source link

Problem with running the code both in colab and local machine #28

Open alimohammadiamirhossein opened 1 year ago

alimohammadiamirhossein commented 1 year ago

Hello,

I really admire your implementation and I am planning to use e4t code but unfortunately I can't run your code. The main problem is in the https://github.com/mkshing/e4t-diffusion/blob/main/pretrain_e4t.py#L238 where we want to load the unet. The corresponding error is

Traceback (most recent call last): File "/content/e4t-diffusion/pretrain_e4t.py", line 691, in main() File "/content/e4t-diffusion/pretrain_e4t.py", line 238, in main unet = load_e4t_unet( File "/content/e4t-diffusion/e4t/utils.py", line 94, in load_e4t_unet if pretrained_model_name_or_path is None or not os.path.exists(ckpt_path): File "/usr/lib/python3.10/genericpath.py", line 19, in exists os.stat(path) TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType Traceback (most recent call last): File "/usr/local/bin/accelerate", line 8, in sys.exit(main()) File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/accelerate_cli.py", line 47, in main args.func(args) File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py", line 986, in launch_command simple_launcher(args) File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py", line 628, in simple_launcher raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd) subprocess.CalledProcessError: Command '['/usr/bin/python3', 'e4t-diffusion/pretrain_e4t.py', '--pretrained_model_name_or_path=CompVis/stable-diffusion-v1-4', '--clip_model_name_or_path=ViT-H-14::laion2b_s32b_b79k', '--domain_class_token=art', '--placeholder_token=s', '--prompt_template=art', '--save_sample_prompt=a photo of the s,a photo of the *s in monet style', '--reg_lambda=0.01', '--domain_embed_scale=0.1', '--output_dir=pretrained-wikiart', '--train_image_dataset=Artificio/WikiArt', '--iterable_dataset', '--resolution=512', '--train_batch_size=16', '--learning_rate=1e-6', '--scale_lr', '--checkpointing_steps=10000', '--log_steps=1000', '--max_train_steps=100000', '--unfreeze_clip_vision', '--mixed_precision=fp16', '--enable_xformers_memory_efficient_attention']' returned non-zero exit status 1

I even tried to download all the files and change the --pretrained_model_name_or_path to local path but it didn't work. I would really appreciate it if you could give me a solution regarding this problem.

h3clikejava commented 11 months ago

$ python inference.py --image_path_or_url "/home/h3c/Desktop/dataset/h3c/20230806-083057.jpg" --pretrained_model_name_or_path "CompVis/stable-diffusion-v1-4" --prompt "Times square in the style of *s" --num_images_per_prompt 3 --scheduler_type "ddim" --image_path_or_url "same image path or url as domain tuning" --num_inference_steps 50 --guidance_scale 7.5 device: cuda Traceback (most recent call last): File "/home/h3c/Documents/e4t-diffusion/inference.py", line 157, in main() File "/home/h3c/Documents/e4t-diffusion/inference.py", line 80, in main config = load_config_from_pretrained(args.pretrained_model_name_or_path) File "/home/h3c/Documents/e4t-diffusion/e4t/utils.py", line 81, in load_config_from_pretrained assert pretrained_model_name_or_path in MODELS, f"Choose from {list(MODELS.keys())}" AssertionError: Choose from ['e4t-diffusion-ffhq-celebahq-v1']

How can i do?