stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[CLIP interrogator] use local file, if available

Open TiagoSantos81 opened this issue 2 years ago • 6 comments

fixes issue mentioned in AUTOMATIC1111/stable-diffusion-webui-feature-showcase#8

TiagoSantos81 avatar Nov 22 '22 12:11 TiagoSantos81

Downloading BLIP...
Error interrogating
Traceback (most recent call last):
  File "D:\AI\SuperSD20\stable-diffusion-webui\modules\interrogate.py", line 175, in interrogate
    self.load()
  File "D:\AI\SuperSD20\stable-diffusion-webui\modules\interrogate.py", line 104, in load
    self.blip_model = self.load_blip_model()
  File "D:\AI\SuperSD20\stable-diffusion-webui\modules\interrogate.py", line 81, in load_blip_model
    open(blip_model_local, 'wb').write(req.get(blip_model_url, allow_redirects=True).content)
FileNotFoundError: [Errno 2] No such file or directory: 'models\\Interrogator\\BLIP_model.pth'

Also, I think you should name it models\BLIP\model_base_caption_capfilt_large.pth to be more consistent with how other model files are named.

CarlKenner avatar Nov 24 '22 02:11 CarlKenner

@CarlKenner Thank you for the heads-up. Forgot to check if the user has the directory. Should work now, but can you please confirm?

TiagoSantos81 avatar Nov 24 '22 13:11 TiagoSantos81

i can't reproduce; blip_decoder already does this; no download is happening for me

AUTOMATIC1111 avatar Nov 27 '22 11:11 AUTOMATIC1111

i can't reproduce; blip_decoder already does this; no download is happening for me

Blip decoder keeps downloading every time you relaunch the app. Maybe you are retrying on the same session. Unless there is an extra code I am missing, the following [former] code also implies that: blip_model = models.blip.blip_decoder(pretrained=blip_model_url, image_size=blip_image_eval_size, vit='base', med_config=os.path.join(paths.paths["BLIP"], "configs", "med_config.json"))

That is the reason for this pull request.

TiagoSantos81 avatar Nov 27 '22 12:11 TiagoSantos81

pycharm64_ki43x062cd

I start the program from scratch, put a breakpoint, do interrogate, and this is where I end up; the file exists, nothing is downloaded.

AUTOMATIC1111 avatar Nov 27 '22 13:11 AUTOMATIC1111

AUTOMATIC1111, this became an unintended bug report. I am lost on what is happening, but that behaviour happens to me, and to @kevinhower that created https://github.com/AUTOMATIC1111/stable-diffusion-webui-feature-showcase/issues/8. If it helps, I have two computers with different webui-user.bat configs.

One has: --lowvram --precision full --no-half --no-half-vae --always-batch-cond-uncond --xformers --autolaunch The other: --medvram --xformers --autolaunch --offline

Note the --offline flag is from my other PR but it only affects the git pulls and installs in initialization.

TiagoSantos81 avatar Nov 27 '22 14:11 TiagoSantos81

Thank you for this contribution and merge! I was also seeing the download repeat needlessly whenever I used the CLIP interrogator, despite it clearly having completed its download before, and I couldn't figure out what was going on. I pulled and tried again after this PR merged, and it didn't repeat the model download. Huzzah! :heart: :rocket:

infinitewarp avatar Dec 06 '22 00:12 infinitewarp