Replies: 2 comments
-
@leyangjin the current main branch is on 0.8.x and there have been quite a few changes from 0.6.x which is the 'stable' release. I've updating models to support the hugging face hub natively and adding multi-weight support (where the '.' dot after the architecture name refers to a specific weight variation), so names have been remapped, and the results files vs the current model names are a bit out of sync... so your observations are correct swinv2_tiny_window16_256.ms_in1k in the 0.8.x library is the same as swinv2_tiny_window16_256 in the 0.6. And the *_22ft1k got remapped to *.ms_in22k_ft_in1k |
Beta Was this translation helpful? Give feedback.
-
Hi @rwightman , thank you so much for your reply. By the way, in version 0.6.x, I find many models don't mention the dataset they are pretrained on in their names, like "swinv2_base_window16_256". For models like "swinv2_base_window16_256", if not specially mentioned, does it mean that they are pretrained on ImageNet-1K by default? For models pretrained on other settings, like "swinv2_base_window12to16_192to256_22kft1k", there will be special flags like "22kft1k", which means this model is pretrained on ImageNet-22K and fine-tuned on ImageNet-1K. Thank you so much for reading this. I am looking forward to your help. |
Beta Was this translation helpful? Give feedback.
-
Hi, the version of timm I used is 0.6.11 and it is installed via PyPI.
Recently I used the model 'swinv2_tiny_window16_256' via the following code:
I find the name of the model 'swinv2_tiny_window16_256' in 'pytorch-image-models/results/results-imagenet-real.csv' in the line 302 of the csv file.
Then I read the source code of timm library. I find the model and pretrained weights originally implemented in the file 'timm/models/swin_transformer_v2.py'. The pretrained weights of the model is mentioned in the line 679 of the python file using the following code:
However, here I find the name of the model "swinv2_tiny_window16_256.ms_in1k" is slightly different from the model name mentioned in 'pytorch-image-models/results/results-imagenet-real.csv' and the model name I used in my code: 'swinv2_tiny_window16_256'. A suffix ".ms_in1k" is added.
When I print the weights loaded using the code
print(model_full.state_dict())
, it actually print out something that is not all equal to zero. But I am really confused about the name difference and wonder whether the weights I loaded is random or the weights pertrained on something like the ImageNet.By the way, I see the following code in the end of 'timm/models/swin_transformer_v2.py':
I see a few models are mapped using this code, like the model 'swinv2_base_window12to16_192to256_22kft1k'. The name 'swinv2_base_window12to16_192to256_22kft1k' is exactly the name mentioned in 'pytorch-image-models/results/results-imagenet-real.csv' and the name on the right ('swinv2_base_window12to16_192to256.ms_in22k_ft_in1k') are exactly the name used to load the pretrained file url in line 656 of 'timm/models/swin_transformer_v2.py'. I wonder whether it means that only these pretrained model in the 'register_model_deprecations' can be loaded via
timm.create_model('a_model_name', pretrained=True)
and other models can not.I also try to examine whether models are pretrained using the code:
and I find both 'swinv2_tiny_window16_256' and 'swinv2_base_window12to16_192to256_22kft1k' are in the output model_pretrain_list.
Thank you so much for reading this. I am looking forward to your help.
Beta Was this translation helpful? Give feedback.
All reactions