mm-cot icon indicating copy to clipboard operation
mm-cot copied to clipboard

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

Open hunwenpinghao opened this issue 1 year ago • 5 comments

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?"

hunwenpinghao avatar Sep 19 '23 09:09 hunwenpinghao

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)

pavankale2709 avatar Oct 01 '23 05:10 pavankale2709

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.

Zhimin00 avatar Oct 09 '23 06:10 Zhimin00

Thanks, this solve the issue.

On Mon, Oct 9, 2023 at 12:14 PM Zhimin00 @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/amazon-science/mm-cot/issues/61#issuecomment-1752426517, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANHWSSMKRVQT67LFOM6D6A3X6OMOVAVCNFSM6AAAAAA4565RF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJSGQZDMNJRG4 . You are receiving this because you commented.Message ID: @.***>

pavankale2709 avatar Oct 09 '23 11:10 pavankale2709

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

zhenglianchi avatar Jan 03 '24 10:01 zhenglianchi

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

Wznnnnn avatar Apr 21 '24 13:04 Wznnnnn