TheLastBen / fast-stable-diffusion

fast-stable-diffusion + DreamBooth
MIT License
7.43k stars 1.28k forks source link

Error preprocessing/captioning images for training #849

Open herbertwestern opened 1 year ago

herbertwestern commented 1 year ago

I got the following error trying to preprocess images with the train tab:

Error completing request Arguments: ('/content/gdrive/MyDrive/AI Training/HiT/Trained HT (Retagged)/Retagged', '/content/gdrive/MyDrive/AI Training/HiT/Trained HT (Retagged)/Normal', 512, 512, 'ignore', False, False, True, False, 0.5, 0.2, True, 0.9, 0.15, 0.5, False) {} Traceback (most recent call last): File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 45, in f res = list(func(*args, *kwargs)) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 28, in f res = func(args, kwargs) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/textual_inversion/ui.py", line 19, in preprocess modules.textual_inversion.preprocess.preprocess(args) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/textual_inversion/preprocess.py", line 23, in preprocess preprocess_work(process_src, process_dst, process_width, process_height, preprocess_txt_action, process_flip, process_split, process_caption, process_caption_deepbooru, split_threshold, overlap_ratio, process_focal_crop, process_focal_crop_face_weight, process_focal_crop_entropy_weight, process_focal_crop_edges_weight, process_focal_crop_debug) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/textual_inversion/preprocess.py", line 193, in preprocess_work save_pic(img, index, params, existing_caption=existing_caption) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/textual_inversion/preprocess.py", line 83, in save_pic save_pic_with_caption(image, index, params, existing_caption=existing_caption) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/textual_inversion/preprocess.py", line 52, in save_pic_with_caption caption += shared.interrogator.generate_caption(image) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/interrogate.py", line 133, in generate_caption caption = self.blip_model.generate(gpu_image, sample=False, num_beams=shared.opts.interrogate_clip_num_beams, min_length=shared.opts.interrogate_clip_min_length, max_length=shared.opts.interrogate_clip_max_length) File "/content/gdrive/MyDrive/sd/stablediffusion/src/blip/models/blip.py", line 156, in generate outputs = self.text_decoder.generate(input_ids=input_ids, File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(args, kwargs) File "/usr/local/lib/python3.8/dist-packages/transformers/generation_utils.py", line 1268, in generate self._validate_model_kwargs(model_kwargs.copy()) File "/usr/local/lib/python3.8/dist-packages/transformers/generation_utils.py", line 964, in _validate_model_kwargs raise ValueError( ValueError: The following model_kwargs are not used by the model: ['encoder_hidden_states', 'encoder_attention_mask'] (note: typos in the generate arguments will also show up in this list)

hrs97 commented 1 year ago

have the same error, waiting for an answer

TheLastBen commented 1 year ago

/content/gdrive/MyDrive/AI Training/HiT/Trained HT (Retagged)/Retagged try removing spaces in the folders names

herbertwestern commented 1 year ago

@TheLastBen

Will do later when I get the chance! Thanks for continuing to look into this.

herbertwestern commented 1 year ago

@TheLastBen

I tried and got the same exact error, unfortunately. So, in the UI, I have issues with CLIP Interrogator on the img2img tab as well. I'm not sure how BLIP (the tagger) and CLIP are related, but it seems like the issues could be? I'm a superficially proficient layman when it comes to technology, so I don't have insight into whether that could be true. Just thought I'd mention. If so, that would be an issue outside of your control, right?

herbertwestern commented 1 year ago

@TheLastBen

Running this in a code cell after running all set-up cells but before running the final cell to start SD fixes the issue:

!pip install transformers==4.19.2