Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: pharmapsychotic's clip-interrogator is broken after a recent update #9035

Closed
1 task done
CypherQube opened this issue Mar 27, 2023 · 6 comments
Closed
1 task done
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@CypherQube
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

I updated Automatic1111 & now https://github.com/pharmapsychotic/clip-interrogator-ext no longer works

Launching Web UI with arguments: --xformers
Error loading script: clip_interrogator_ext.py
Traceback (most recent call last):
File "C:\Users\User\stable-diffusion-webui\modules\scripts.py", line 256, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "C:\Users\User\stable-diffusion-webui\modules\script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Users\User\stable-diffusion-webui\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 9, in
import clip_interrogator
File "C:\Users\User\stable-diffusion-webui\venv\lib\site-packages\clip_interrogator_init
.py", line 1, in
from .clip_interrogator import Config, Interrogator, LabelTable, list_caption_models, list_clip_models, load_list
File "C:\Users\User\stable-diffusion-webui\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 12, in
from transformers import AutoProcessor, AutoModelForCausalLM, BlipForConditionalGeneration, Blip2ForConditionalGeneration
ImportError: cannot import name 'Blip2ForConditionalGeneration' from 'transformers' (C:\Users\User\stable-diffusion-webui\venv\lib\site-packages\transformers_init_.py)

Steps to reproduce the problem

  1. Go to ....
  2. Press ....
  3. ...

What should have happened?

It should work & the tab should show up in the UI

Commit where the problem happens

955df77

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Brave

Command Line Arguments

--xformers

List of extensions

clip-interrogator-ext https://github.com/pharmapsychotic/clip-interrogator-ext.git 1ecedb5c (Sat Mar 25 17:55:23 2023) unknown
depthmap2mask https://github.com/Extraltodeus/depthmap2mask.git 7eedf6af (Mon Mar 20 10:16:05 2023) unknown
sd-dynamic-thresholding https://github.com/mcmonkeyprojects/sd-dynamic-thresholding.git 7a9f2694 (Wed Mar 22 17:02:01 2023) unknown
sd-webui-llul https://github.com/hnmr293/sd-webui-llul.git b20337ae (Wed Mar 22 15:56:08 2023) unknown
sd-webui-model-converter https://github.com/Akegarasu/sd-webui-model-converter.git d19e2816 (Sun Mar 26 06:36:49 2023) unknown
sd_dreambooth_extension https://github.com/d8ahazard/sd_dreambooth_extension.git 3324b6ab (Sun Mar 26 00:34:34 2023) unknown
stable-diffusion-webui-anti-burn https://github.com/klimaleksus/stable-diffusion-webui-anti-burn.git 4d678f1f (Sun Feb 19 19:22:44 2023) unknown
stable-diffusion-webui-rembg https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg.git 64821f04 (Sun Mar 12 15:32:00 2023) unknown
stable-diffusion-webui-tokenizer https://github.com/AUTOMATIC1111/stable-diffusion-webui-tokenizer.git ac6d541c (Sat Dec 10 12:58:31 2022) unknown
ultimate-upscale-for-automatic1111 https://github.com/Coyote-A/ultimate-upscale-for-automatic1111.git 0a3d03a4 (Tue Feb 7 06:07:23 2023) unknown

Console logs

Launching Web UI with arguments: --xformers
Error loading script: clip_interrogator_ext.py
Traceback (most recent call last):
  File "C:\Users\User\stable-diffusion-webui\modules\scripts.py", line 256, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "C:\Users\User\stable-diffusion-webui\modules\script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\User\stable-diffusion-webui\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 9, in <module>
    import clip_interrogator
  File "C:\Users\User\stable-diffusion-webui\venv\lib\site-packages\clip_interrogator\__init__.py", line 1, in <module>
    from .clip_interrogator import Config, Interrogator, LabelTable, list_caption_models, list_clip_models, load_list
  File "C:\Users\User\stable-diffusion-webui\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 12, in <module>
    from transformers import AutoProcessor, AutoModelForCausalLM, BlipForConditionalGeneration, Blip2ForConditionalGeneration
ImportError: cannot import name 'Blip2ForConditionalGeneration' from 'transformers' (C:\Users\User\stable-diffusion-webui\venv\lib\site-packages\transformers\__init__.py)

Additional information

No response

@CypherQube CypherQube added the bug-report Report of a bug, yet to be confirmed label Mar 27, 2023
@akx
Copy link
Collaborator

akx commented Mar 27, 2023

Report the issue in that extension's issue tracker then, not here. https://github.com/pharmapsychotic/clip-interrogator-ext/issues

@bryanray
Copy link

bryanray commented Mar 27, 2023

the built-in deepbooru / clip interrogators are clever and precise enough, i used to use wd-tagger cause it has a hierarchy of tags, but now i mostly just use the img2img interrogtaor, it is fast to use deepbooru, beaware it has nai tag sometimes.

also wd-tagger store model in temp folder, doesnt allow you to store it logically in local folder, thats another reason i abandon it all together :))

@pharmapsychotic
Copy link

pharmapsychotic commented Mar 27, 2023

@CypherQube if you delete the clip-interrogator extension then install it again and restart webui it should get you the proper version of transformers and work again for you.

@pharmapsychotic
Copy link

@AUTOMATIC1111 can the webui requirements be updated to transformers>=4.27.1 or just from transformers==4.25.1 to transformers>=4.25.1 ? The DreamBooth extension updated to require 4.26 which broke my extension so I updated to latest but main webui is pinning older version than both.

@ClashSAN
Copy link
Collaborator

ClashSAN commented Apr 1, 2023

@pharmapsychotic feel free to submit a pull request to webui, I submitted a request #9241 so these types of things can be looked at more quickly.

akx added a commit to akx/sd-webui that referenced this issue May 28, 2023
dario-github pushed a commit to BlueFocusContentUniverse/stable-diffusion-webui that referenced this issue Jun 27, 2023
theBlaufuss added a commit to theBlaufuss/stable-diffusion-webui that referenced this issue Jun 30, 2023
* repair file paste for Firefox from AUTOMATIC1111#10615
remove animation when pasting files into prompt
rework two dragdrop js files into one

* Upgrade Gradio, remove docs URL hack

* fix error in dragdrop logic

* Add custom karras scheduler

* remove debug print

* `modules/api/api.py`: disable `timeout_keep_alive`

* Add dropdown for scheduler type

* Change karras to kdiffusion

* Replace karras by k_diffusion, fix gen info

* only add metadata when k_sched is actually been used

* remove not related code

* Avoid loop import

* Minor naming fixes

* Add error information for recursion error

* use sigma_max/min in model if sigma_max/min is 0

* Revert AUTOMATIC1111#10586

* Fix for AUTOMATIC1111#10643 (pixel noise in webui inpainting canvas breaking inpainting, so that it behaves like plain img2img)

* Better hint for user

Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>

* Add hint for custom k_diffusion scheduler

* Use settings instead of main interface

* Use better way to impl

* Fix xyz

* Subject:.
Improvements to handle VAE filenames in generated image filenames

Body:.
1) Added new line 24 to import sd_vae module.
2) Added new method get_vae_filename at lines 340-349 to obtain the VAE filename to be used for image generation and further process it to extract only the filename by splitting it with a dot symbol.
3) Added a new lambda function 'vae_filename' at line 373 to handle VAE filenames.

Reason:.
A function was needed to get the VAE filename and handle it in the program.

Test:.
We tested whether we could use this new functionality to get the expected file names.
The correct behaviour was confirmed for the following commonly distributed VAE files.
vae-ft-mse-840000-ema-pruned.safetensors -> vae-ft-mse-840000-ema-pruned
anything-v4.0.vae.pt -> anything-v4.0

ruff response:.
There were no problems with the code I added.

There was a minor configuration error in a line I did not modify, but I did not modify it as it was not relevant to this modification.
Logged.
images.py:426:56: F841 [*] Local variable `_` is assigned to but never used
images.py:432:43: F841 [*] Local variable `_` is assigned to but never used

Impact:.
This change makes it easier to retrieve the VAE filename used for image generation and use it in the programme.

* Use type to determine if it is enable

* fix bad styling for thumbs view in extra networks AUTOMATIC1111#10639

* possible fix for empty list of optimizations AUTOMATIC1111#10605

* Fix ruff error

* Use automatic instead of None/default

* improvements

See:
AUTOMATIC1111#10649 (comment)

* use Schedule instead of Sched

* Changed 'images.zip' to generation by pattern

* Optimize tooltip checks

* Instead of traversing tens of thousands of text nodes, only look at elements and their children
* Debounce the checks to happen only every one second

* Restore support for dropdown tooltips

* Add support for tooltips on dropdown options

* Cleaner image metadata read

* Just use console.error, it's in all browsers

* Merge executeCallbacks and runCallback, simplify + optimize

* Document on* handlers (for extension authors' sake)

* Add onAfterUiUpdate callback

* Use onAfterUiUpdate where possible

* Remove try/except in img metadata read

* Small fixes to prepare_tcmalloc for Debian/Ubuntu compatibility

- /usr/sbin (where ldconfig is usually located) is not typically on users' PATHs by default, so we set that variable before trying to run ldconfig.
- The libtcmalloc library is called libtcmalloc_minimal on Debian/Ubuntu systems. We now check whether libtcmalloc_minimal exists when running prepare_tcmalloc.

* change to AMD only if NVIDIA is not presented

* Update webui.sh

* Remove exit() from select_checkpoint()

Raising a FileNotFoundError instead.

* Show full traceback in get_sd_model()

to reveal if an error is caused by an extension

* custom unet support

* fix serving images that have already been saved without temp files function that broke after updating gradio

* updates for the noise schedule settings

* Ability to zoom and move the canvas

* Formatted Prettier added fullscreen mode canvas expansion function

* Improve reset zoom when toggle tabs

* add quoting for infotext values that have a colon in them

* Mark caption_image_overlay's textfont as deprecated; fix AUTOMATIC1111#10778

* Sort requirements files

* Upgrade xformers

* Synchronize requirements/requirements_versions

* Remove deps not listed in _versions from requirements

* Omit versions when they don't match _versions

* fix "hires. fix" prompt/neg sharing same labels as txt2img_prompt/negative_prompt

* typo

vidocard -> videocard

* Corrected the code according to Code style

* changed the document to gradioApp()

* Round down scale destination dimensions to nearest multiple of 8

* Refactor EmbeddingDatabase.register_embedding() to allow unregistering

* fix xyz clip

* Upgrade transformers

Refs AUTOMATIC1111#9035 (comment)

* fix disable png info

* clarify issue template

* Only poll gamepads while connected

* Update imageviewerGamepad.js

* Patch GitPython to not use leaky persistent processes

* Add & use modules.errors.print_error where currently printing exception info by hand

* Revert "fix xyz clip"

This reverts commit edd766e.

* fix get_conds_with_caching()

* improve filename matching for mask

we should not rely that mask filename will be of the same extension
as the image filename so better pattern matching is added

* add scale_by to batch processing

* ruffed

* Moved the script to the extension build-in

* Added VAE listing to web API.

* Fix s_min_uncond default type int

* Move gamepaddisconnected listener

* Vendor in the single module used from taming_transformers; remove taming_transformers dependency

(and fix the two ruff complaints)

* a small fix for very wide images, because of the scroll bar was the wrong zoom

* Frontend: only look at top-level tabs, not nested tabs

Refs adieyal/sd-dynamic-prompts#459 (comment)

* Fix typo in `--update-check` help message

Change `chck` to `check`

* rename print_error to report, use it with together with package name

* change UI reorder setting to multiselect

* add an option to show selected setting in main txt2img/img2img UI
split some code from ui.py into ui_settings.py ui_gradio_edxtensions.py
add before_process callback for scripts
add ability for alwayson scripts to specify section and let user reorder those sections

* fix [Bug]: LoRA don't apply on dropdown list sd_lora AUTOMATIC1111#10880

* Fixed the problem with sticking to the mouse, created a tooltip

* use ui_reorder_list rather than ui_reorder for UI reorder option to make the program not break when reverting to old version

* fix 10896 pnginfo parameters

* remove redundant

* assign devices.dtype early because it's needed before the model is loaded

* revert default cross attention optimization to Doggettx
make --disable-opt-split-attention command line option work again

* add hiding and a colspans to startup profile table

* add subdir support for images, masks and output; search mask only in subdir

* fallback to original file retrieving; skip img if mask not found

usage of `shared.walk_files` breaks controlnet extension
images are processed in different order 
which leads to unmatched img file used for img2img and img file used for controlnet 
(if no folder is specified for control net
or the same as img2img input dir used for it)

* revert the erroneous change for model setting added in df02498

* Added the ability to configure hotkeys via webui

Now you can configure the hotkeys directly through the settings

JS and Python scripts are tested and code style compliant

* Added a hotkey repeat check to avoid bugs

* Support dynamic sort of extra networks

* lint fixes

* Cross attention optimization

Cross attention optimization

cross attention optimization

* remove redundant call list_optimizers()

* remove redundant

* Simplify a bunch of `len(x) > 0`/`len(x) == 0` style expressions

* fallback version info form CHANGELOG.md

* Made tooltip optional.

You can disable it in the settings.
Enabled by default

* Added support for workarounds on external GPU.

lspci detects VGA for main/integrated videocards and Display
for external videocards.

This commit should apply workarounds on computers with more than
one GPU. Useful for most laptops using weak iGPU and good dGPU.

Signed-off-by: Pablo Cholaky <waltercool@slash.cl>

* Apply suggestions from code review

Co-authored-by: Aarni Koskela <akx@iki.fi>

* Added the ability to swap the zoom hotkeys and resize the brush

* small ui fix

In the error the user will see R instead of KeyR

* Update modules/launch_utils.py

Co-authored-by: Aarni Koskela <akx@iki.fi>

* fallback version info form CHANGELOG.md

* a yet another method to restart webui

* Added sysinfo tab to settings

* lint

* Round upscaled dimensions only when not divisible by 8

* Use a more concise calculation for dest dims

* Fix missing ext_filter kwarg

* Made the applyZoomAndPan function global for other extensions

* torch.cuda.is_available() check for SdOptimizationXformers

* fix conds caching with extra network

* simplify self.extra_network_data

* remove redone compare

* Fixed the redmask bug

* Made a function applyZoomAndPan isolated each instance

Isolated each instance of applyZoomAndPan, now if you add another element to the page, they will work correctly

* Fixed visual bugs

* Correct definition zoom level

I changed the regular expression and now I always have to select scale from style.transfo

* Update ui_tempdir.py

Make override function have the same input parameters with original function

* infer styles from prompts, and an option to control the behavior

* add whitelist for environment in the report
add extra link to view the report instead of downloading it

* fix the broken line for AUTOMATIC1111#10990

* fix for conds of second hires fox pass being calculated using first pass's networks, and add an option to revert to old behavior

* prevent calculating cons for second pass of hires fix when they are the same as for the first pass

* Add endpoint to get latent_upscale_modes for hires fix

* Zoom and Pan: move helpers into its namespace to avoid littering global scope

* Zoom and Pan: use elementIDs from closure scope

* Zoom and Pan: simplify getElements (it's not actually async)

* Zoom and Pan: use for instead of forEach

* Zoom and Pan: simplify waitForOpts

* revert the message to how it was

* rework-disable-autolaunch

* Restart: only do restart if running via the wrapper script

* restore old disable --autolaunch

* SD_WEBUI_RESTARTING

* print error and continue

print error and continue

* Forcing Torch Version to 1.13.1 for Navi and Renoir GPUs

* Fix error in webui.sh

* Force python1 for Navi1 only, use python_cmd for python

* Check python version for Navi 1 only

* Write "RX 5000 Series" instead of "Navi" in err

* link footer API to Wiki when API is not active

* Skip force pyton and pytorch ver if TORCH_COMMAND already set

* Fix upcast attention dtype error.

Without this fix, enabling the "Upcast cross attention layer to float32" option while also using `--opt-sdp-attention` breaks generation with an error:

```
  File "/ext3/automatic1111/stable-diffusion-webui/modules/sd_hijack_optimizations.py", line 612, in sdp_attnblock_forward
    out = torch.nn.functional.scaled_dot_product_attention(q, k, v, dropout_p=0.0, is_causal=False)
RuntimeError: Expected query, key, and value to have the same dtype, but got query.dtype: float key.dtype: float and value.dtype: c10::Half instead.
```

The fix is to make sure to upcast the value tensor too.

* persistent conds cache

Update shared.py

* Generate Forever during generation

Generate Forever during generation

* Split mask blur into X and Y components

Prequisite to fixing Outpainting MK2 mask blur bug.

* Split Outpainting MK2 mask blur into X and Y components

Fixes unexpected noise in non-outpainted borders when using MK2 script.

* Don't die when a LoRA is a broken symlink

Fixes AUTOMATIC1111#11098

* linter

* add changelog for 1.4.0

* fixed typos

* Improved error output, improved settings menu

* remove console.log

* Use os.makedirs(..., exist_ok=True)

* Reworked the disabling of functions, refactored part of the code

* Formatting code with Prettier

* Fix Typo of hints.js

* Strip whitespaces from URL and dirname prior to extension installation

This avoid some cryptic errors brought by accidental spaces around urls

* add missing infotext entry for the pad cond/uncond option

---------

Signed-off-by: Pablo Cholaky <waltercool@slash.cl>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>
Co-authored-by: Monty Anderson <work@montyanderson.net>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: ArthurHeitmann <37270165+ArthurHeitmann@users.noreply.github.com>
Co-authored-by: fumitaka.yano <fumitaka.yano@mixi.co.jp>
Co-authored-by: strelokhalfer <strelokhalfer@gmail.com>
Co-authored-by: kernelmethod <17100608+kernelmethod@users.noreply.github.com>
Co-authored-by: Roman Beltiukov <maybe.hello.world@gmail.com>
Co-authored-by: linkoid <36754150+linkoid@users.noreply.github.com>
Co-authored-by: Danil Boldyrev <daswerq123@gmail.com>
Co-authored-by: Sakura-Luna <53183413+Sakura-Luna@users.noreply.github.com>
Co-authored-by: nyqui <67160376+nyqui@users.noreply.github.com>
Co-authored-by: yoinked <pepe.dannyboy@gmail.com>
Co-authored-by: ramyma <ramy.mahmoudi@gmail.com>
Co-authored-by: klimaleksus <klimaleksus@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: Artem Kotov <breengles@gmail.com>
Co-authored-by: James <james@JAMES-PC.localhost>
Co-authored-by: David Chuang <dc1770712@gmail.com>
Co-authored-by: Will Frey <jfrey89@gmail.com>
Co-authored-by: Pablo Cholaky <waltercool@slash.cl>
Co-authored-by: Chanchana Sornsoontorn <off9955555@gmail.com>
Co-authored-by: Vivek K. Vasishtha <vivekkumar.be01@gmail.com>
Co-authored-by: Vesnica <Vesnica@users.noreply.github.com>
Co-authored-by: DGdev91 <iperpido91@gmail.com>
Co-authored-by: Alexander Ljungberg <aljungberg@wireload.net>
Co-authored-by: Splendide Imaginarius <119545140+Splendide-Imaginarius@users.noreply.github.com>
Co-authored-by: arch-fan <juanserracines@gmail.com>
Co-authored-by: zhtttylz <hualong.z@hotmail.com>
Co-authored-by: Jabasukuriputo Wang <wfjsw@users.noreply.github.com>
@akx
Copy link
Collaborator

akx commented Jun 30, 2023

Closing since transformers is now a more compatible version.

@akx akx closed this as completed Jun 30, 2023
dario-github pushed a commit to BlueFocusContentUniverse/stable-diffusion-webui that referenced this issue Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

5 participants