microsoft / Cream

This is a collection of our NAS and Vision Transformer work.
MIT License
1.66k stars 225 forks source link

error when use the tinyvit #175

Closed AmberCheng closed 1 year ago

AmberCheng commented 1 year ago

model = model_cls(kwargs) if model_cfg is None else model_cls(cfg=model_cfg, kwargs) TypeError: init() got an unexpected keyword argument 'default_cfg'

Hi, I have met the error when I try to use the code:

from tiny_vit import tiny_vit_21m_224
model = tiny_vit_21m_224(pretrained=True)
output = model(image)

I wonder do I miss something?

wkcn commented 1 year ago

Hi @AmberCheng , thanks for your attention to our work!

It seems to be related to timm version.

Could you please upgrade timm (version>=0.4.12) by the following command?

pip install timm==0.4.12

Check the version of timm

python -c "import timm; print(timm.__version__)"
AmberCheng commented 1 year ago

Actually, I found that the version of my timm is timm-0.6.11. And I tried the 0.4.12, it works! I appreciate for your help!

wkcn commented 1 year ago

Thanks for pointing the bug out! I will make it compatible with timm-0.6.11.

wkcn commented 1 year ago

The latest code supports timm>=0.6.11 now.

Close the issue. Feel free to reopen it if any problem.