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

ImportError: cannot import name 'Conv2dSame' from 'timm.models.layers' (unknown location) #61

Open
hunwenpinghao opened this issue Sep 19, 2023 · 5 comments

Comments

@hunwenpinghao
Copy link

hunwenpinghao commented Sep 19, 2023

When I run the script extract_features.py, I encountered the following error:
ImportError: cannot import name 'Conv2dSame' from 'timm.models.layers' (unknown location)
My Python version is 3.9.12. Do I need to use Python 3.8 or 3.7 instead?"

@pavankale2709
Copy link

pavankale2709 commented Oct 1, 2023

Hi, Thanks for the great work, I was trying to check how this code works.
I am also facing same. Can you please share files in layers directory and others those are required to run that code and currently those are not uploaded in git.
Thanks


raceback (most recent call last):
File "...\mm-cot-scienceqa\extract_features.py", line 4, in
import timm
File "...\mm-cot-scienceqa\timm_init_.py", line 2, in
from .models import create_model, list_models, is_model, list_modules, model_entrypoint,
File "...\mm-cot-scienceqa\timm\models_init_.py", line 1, in
from .byoanet import *
File "...\mm-cot-scienceqa\timm\models\byoanet.py", line 16, in
from .byobnet import ByoBlockCfg, ByoModelCfg, ByobNet, interleave_blocks
File "...\mm-cot-scienceqa\timm\models\byobnet.py", line 36, in
from .helpers import build_model_with_cfg
File "...\mm-cot-scienceqa\timm\models\helpers.py", line 18, in
from .layers import Conv2dSame, Linear
ImportError: cannot import name 'Conv2dSame' from 'timm.models.layers' (unknown location)

@Zhimin00
Copy link

Zhimin00 commented Oct 9, 2023

I downloaded the files in layers directory from https://github.com/huggingface/pytorch-image-models/tree/main/timm/layers and substituted the corresponding directory of 'mm-cot/timm/models/layers', which solved the ImportError.

@pavankale2709
Copy link

pavankale2709 commented Oct 9, 2023 via email

@zhenglianchi
Copy link

ImportError: cannot import name 'convert_norm_act' from 'timm.models.layers'
Do you have such a question

@Wznnnnn
Copy link

Wznnnnn commented Apr 21, 2024

ImportError: cannot import name 'convert_norm_act' from 'timm.models.layers' Do you have such a question

I downloaded the files from https://github.com/huggingface/pytorch-image-models/ and Replace the entire timm folder.

It works for me

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

5 participants