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

Depth Anything is not working in A1111 Version: v1.9.4 - Always errors with TypeError: Expected state_dict to be dict-like, got <class 'NoneType'> #456

Open
LVNSDCAPE opened this issue Jul 5, 2024 · 11 comments

Comments

@LVNSDCAPE
Copy link

LVNSDCAPE commented Jul 5, 2024

Depth Anything is not working in A1111 Version: v1.9.4 - on my side.

It always errors with TypeError: Expected state_dict to be dict-like, got <class 'NoneType'

I reinstalled the Plugin two times and it is same behavior.
Also used pip install -r requirements.txt and there have been no errors during this.

Final info here is:
Successfully installed depth-anything-2024.1.22.0 timm-0.9.16

My Specs:

Windows 10 64 Bit
RTX 3080

A1111:
version: [v1.9.4]•  python: 3.10.9  •  torch: 2.1.2+cu121  •  xformers: 0.0.23.post1  •  gradio: 3.41.2  •

Settings to replicate

2024-07-05 19_12_38-

@DrSniffy
Copy link

DrSniffy commented Aug 6, 2024

Same here, and the tabs has also gone. I'm using Forge, and seems like an update Forge did killed Depth maybe...

@semjon00
Copy link
Collaborator

semjon00 commented Aug 6, 2024

@DrSniffy Could you please provide the stacktrace (the full error message which is very long)?

@hutje
Copy link

hutje commented Aug 6, 2024

I got the same problem. I use SD Forge and it seems the ui_tab_callback gives an error.

Details of the whole start up log

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Version: f1.0.2v1.10.1-previous-151-gb7878058 Commit hash: b7878058f9144201924cf983e64d08174cf1756e Launching Web UI with arguments: Total VRAM 8188 MB, total RAM 97925 MB pytorch version: 2.1.2+cu121 Set vram state to: NORMAL_VRAM Device: cuda:0 NVIDIA GeForce RTX 4070 Laptop GPU : native Hint: your device supports --pin-shared-memory for potential speed improvements. Hint: your device supports --cuda-malloc for potential speed improvements. Hint: your device supports --cuda-stream for potential speed improvements. VAE dtype preferences: [torch.bfloat16, torch.float32] -> torch.bfloat16 CUDA Stream Activated: False Using pytorch cross attention Using pytorch attention for VAE ControlNet preprocessor location: C:\AI\SD Forge\webui_forge_cu121_torch21\webui\models\ControlNetPreprocessor WARNING:dinov2:xFormers not available WARNING:dinov2:xFormers not available Loading weights [15012c538f] from C:\AI\SD Forge\webui_forge_cu121_torch21\webui\models\Stable-diffusion\realisticVisionV51_v51VAE.safetensors StateDict Keys: {'unet': 686, 'vae': 248, 'text_encoder': 197, 'ignore': 0} 2024-08-06 17:15:26,043 - ControlNet - INFO - ControlNet UI callback registered. Working with z of shape (1, 4, 32, 32) = 4096 dimensions. *** Error executing callback ui_tabs_callback for C:\AI\SD Forge\webui_forge_cu121_torch21\webui\extensions\stable-diffusion-webui-depthmap-script\scripts\depthmap.py Traceback (most recent call last): File "C:\AI\SD Forge\webui_forge_cu121_torch21\webui\modules\script_callbacks.py", line 283, in ui_tabs_callback res += c.callback() or [] File "C:\AI\SD Forge\webui_forge_cu121_torch21\webui\extensions\stable-diffusion-webui-depthmap-script\scripts\depthmap.py", line 104, in script_callbacks.on_ui_tabs(lambda: [(common_ui.on_ui_tabs(), "Depth", "depthmap_interface")]) File "C:\AI\SD Forge\webui_forge_cu121_torch21\webui\extensions\stable-diffusion-webui-depthmap-script\src\common_ui.py", line 289, in on_ui_tabs inp += gr.File(label="Custom DepthMap", file_count="single", interactive=True, File "C:\AI\SD Forge\webui_forge_cu121_torch21\webui\modules\gradio_extensions.py", line 126, in __repaired_init__ original(self, *args, **fixed_kwargs) File "C:\AI\SD Forge\webui_forge_cu121_torch21\system\python\lib\site-packages\gradio\component_meta.py", line 163, in wrapper return fn(self, **kwargs) File "C:\AI\SD Forge\webui_forge_cu121_torch21\system\python\lib\site-packages\gradio\components\file.py", line 98, in __init__ raise ValueError( ValueError: Invalid value for parameter `type`: file. Please choose from one of: ['filepath', 'binary']

@graemeniedermayer
Copy link
Contributor

graemeniedermayer commented Aug 20, 2024

We might want to make a separate branch for sd forge or newer versions.

Anywhere were we use gr.File the parameter type='file' needs to be replaced with type='binary' but I'm pretty sure this will be a breaking change for people using older versions.

Also we are going to need to do a bunch of other work to make the UI work. The API still works somehow haha.

flux only works on newer versions so I expect this to be a more common problem.

edit: So it seems that the model unload/reload needs edits, but that seems to be the only other issue.

@semjon00
Copy link
Collaborator

Uh-oh... This indeed may be a challenge. But I still hope that we could work around it without making a new branch. Basically we will need to detect which variant it is and then use the correct string. I feel that somehow it should be possible, but who knows.

@tommcg
Copy link

tommcg commented Sep 16, 2024

We might want to make a separate branch for sd forge or newer versions.

Anywhere were we use gr.File the parameter type='file' needs to be replaced with type='binary' but I'm pretty sure this will be a breaking change for people using older versions.

Also we are going to need to do a bunch of other work to make the UI work. The API still works somehow haha.

flux only works on newer versions so I expect this to be a more common problem.

edit: So it seems that the model unload/reload needs edits, but that seems to be the only other issue.

Is this a matter of a find and replace for the 'type' in order for it to work in Forge?

@graemeniedermayer
Copy link
Contributor

I think it partially fixes some of the extension, but the memory loading and unloading also needs to be modified. If you have a bigger gpu you might just be able to remove the unloading part.

I'll try put some time into a forge branch this week.

@graemeniedermayer
Copy link
Contributor

Okay after looking into this.

The main issue is forge is using Gradio 4.xx vs auto1111 using Gradio 3.xx.

So it's going to be a fairly significant rewrite of common_ui.py.

@graemeniedermayer
Copy link
Contributor

Here's my first go at forge compatibility if you'd like to test out,
#467

@tommcg
Copy link

tommcg commented Sep 18, 2024

Here's my first go at forge compatibility if you'd like to test out, #467

This is on the edge of my understanding of how to implement this update. Do I go to your commit and then copy and replace the 4 files over the default forge and extension scripts?

@semjon00
Copy link
Collaborator

@tommcg This is one way to fo it, yes, but this will be fixed in the next update, so another way would be to update the extension once it is out (soon).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants