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

module 'timm.models._registry' has no attribute 'get_pretrained_cfgs_for_arch' #88

Open
KimJaeYoon01 opened this issue Oct 15, 2024 · 8 comments

Comments

@KimJaeYoon01
Copy link

KimJaeYoon01 commented Oct 15, 2024

C:\ComfyUI_windows_portable>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
[START] Security scan
[DONE] Security scan

ComfyUI-Manager: installing dependencies done.

** ComfyUI startup time: 2024-10-15 20:27:36.387668
** Platform: Windows
** Python version: 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
** Python executable: C:\ComfyUI_windows_portable\python_embeded\python.exe
** ComfyUI Path: C:\ComfyUI_windows_portable\ComfyUI
** Log path: C:\ComfyUI_windows_portable\comfyui.log
[ComfyUI-Manager] WARN: Unsafe - SSL verification bypass option is Enabled. (see ComfyUI-Manager/config.ini)

Prestartup times for custom nodes:
0.9 seconds: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager

Total VRAM 12288 MB, total RAM 65462 MB
pytorch version: 2.4.1+cu124
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3060 : cudaMallocAsync
Using pytorch cross attention
[Prompt Server] web root: C:\ComfyUI_windows_portable\ComfyUI\web
C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\kornia\feature\lightglue.py:44: FutureWarning: torch.cuda.amp.custom_fwd(args...) is deprecated. Please use torch.amp.custom_fwd(args..., device_type='cuda') instead.
@torch.cuda.amp.custom_fwd(cast_inputs=torch.float32)
Total VRAM 12288 MB, total RAM 65462 MB
pytorch version: 2.4.1+cu124
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3060 : cudaMallocAsync

Loading: ComfyUI-Manager (V2.51.7)

ComfyUI Revision: 2761 [f5847582] | Released on '2024-10-14'

[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
[ReActor] - STATUS - Running v0.5.1-b2 in ComfyUI
Torch version: 2.4.1+cu124
C:\ComfyUI_windows_portable
############################################
C:\ComfyUI_windows_portable\custom_nodes\ComfyUI-NAI-styler\CSV
############################################
[]
############################################
Traceback (most recent call last):
File "C:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 2001, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_segment_anything_init
.py", line 1, in
from .node import *
File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_segment_anything\node.py", line 17, in
from sam_hq.build_sam_hq import sam_model_registry
File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_segment_anything\sam_hq\build_sam_hq.py", line 13, in
from .modeling.tiny_vit import TinyViT
File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_segment_anything\sam_hq\modeling\tiny_vit.py", line 17, in
from timm.models.registry import register_model
File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\timm\models\registry.py", line 1, in
from ._registry import *
AttributeError: module 'timm.models._registry' has no attribute 'get_pretrained_cfgs_for_arch'

Cannot import C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_segment_anything module for custom nodes: module 'timm.models._registry' has no attribute 'get_pretrained_cfgs_for_arch'

Import times for custom nodes:
0.0 seconds: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\websocket_image_save.py
0.0 seconds: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-NAI-styler
0.0 seconds: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Universal-Styler
0.0 seconds: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Custom-Scripts
0.0 seconds: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-segment-anything-2
0.0 seconds: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-KJNodes
0.1 seconds: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-VideoHelperSuite
0.2 seconds (IMPORT FAILED): C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_segment_anything
0.2 seconds: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager
1.0 seconds: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-reactor-node

Starting server

To see the GUI go to: http://127.0.0.1:8188
FETCH DATA from: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager\extension-node-map.json [DONE]

I'm experiencing this error. Can anyone help me? I've tried installing it after deleting the module, but it's not working out. Also, I've tried looking at various materials and actually trying it out, but it's not working out.
0.9.12,
0.6.13
0.6.12
1.0.10
I tried various versions

@jroessler
Copy link

jroessler commented Oct 15, 2024

As you can see in the error log, timm is causing the issue. For now, downgrade timm to 1.0.9 worked for me (they recently updated timm to 1.0.10 which is causing the issue because of some renaming, I guess).

pip install 'timm==1.0.9'

@zhendery
Copy link

As you can see in the error log, timm is causing the issue. For now, downgrade timm to 1.0.9 worked for me (they recently updated timm to 1.0.10 which is causing the issue because of some renaming, I guess).

pip install 'timm==1.0.9'

works for me

@rwightman
Copy link

usages of from timm.models.registry import register_model that exist in this lib should be changed to from timm.models import register_model it was deprecated 2 years ago

@MBiarreta
Copy link

MBiarreta commented Oct 16, 2024

Hi! i just got this error but installling timm 1.0.9 is not solving it for me, does anyone know if there's something else i can do?

I get it when i run this line to use the BiRefNet model:

birefnet = AutoModelForImageSegmentation.from_pretrained("ZhengPeng7/BiRefNet", trust_remote_code=True)

@rwightman
Copy link

rwightman commented Oct 16, 2024

@MBiarreta it's likely you still have timm 1.0.10 active in your environment. I am releasing 1.0.11 within hours that will remove the issue so the deprecated imports still work, but it will have a more visible warning when using deprecated import paths.

The model in question has this in the model code (remote code in HF hub model) which are both deprecated paths.

from timm.models.layers import DropPath, to_2tuple, trunc_normal_
from timm.models.registry import register_model

Under the structure that's been there for 2 years now, it should be

from timm.layers import DropPath, to_2tuple, trunc_normal_
from timm.models import register_model

@MBiarreta
Copy link

You were right 😅 i restarted my environment and it's solved now, thanks for your quick answer!

@TalhaKarakoyunlu
Copy link

As you can see in the error log, timm is causing the issue. For now, downgrade timm to 1.0.9 worked for me (they recently updated timm to 1.0.10 which is causing the issue because of some renaming, I guess).

pip install 'timm==1.0.9'

Worked for me as well

@rwightman
Copy link

FWIW 1.0.11 is released to fix the issue, but probably around end of 2024/early 2025 I'll be ending that deprecation path as part of a significant update w/ new supported tasks

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