-
Notifications
You must be signed in to change notification settings - Fork 39
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
How to solve this problem? #11
Comments
If I use the following code, can I avoid downloading pre training weights? self.extractor = timm.create_model('swin_large_patch4_window12_384_in22k', pretrained=False) |
Sure! But we use timm model, please check the pre-trained model is fitting timm provided. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, bro, your code is very beautiful, but I made the following error when using swin-t to run the code. How can I use the pre training weight downloaded by myself instead of downloading at run time.
Traceback (most recent call last):
File "train.py", line 396, in
train_loader, test_loader, model, optimizer, schedule = set_environment(args)
File "train.py", line 94, in set_environment
model = SwinVit12(
File "/home/pengtl/jackhu/FGVC-PIM-master/models/SwinVit12.py", line 202, in init
self.extractor = timm.create_model('swin_large_patch4_window12_384_in22k', pretrained=True)
File "/home/pengtl/jackhu/FGVC-PIM-master/timm/models/factory.py", line 81, in create_model
model = create_fn(pretrained=pretrained, **kwargs)
File "/home/pengtl/jackhu/FGVC-PIM-master/timm/models/swin_transformer.py", line 654, in swin_large_patch4_window12_384_in22k
model = _create_swin_transformer('swin_large_patch4_window12_384_in22k', pretrained=pretrained, **model_kwargs)
File "/home/pengtl/jackhu/FGVC-PIM-master/timm/models/swin_transformer.py", line 562, in _create_swin_transformer
model = build_model_with_cfg(
File "/home/pengtl/jackhu/FGVC-PIM-master/timm/models/helpers.py", line 457, in build_model_with_cfg
load_pretrained(
File "/home/pengtl/jackhu/FGVC-PIM-master/timm/models/helpers.py", line 184, in load_pretrained
state_dict = load_state_dict_from_url(pretrained_url, progress=progress, map_location='cpu')
File "/home/pengtl/anaconda3/lib/python3.8/site-packages/torch/hub.py", line 528, in load_state_dict_from_url
return torch.load(cached_file, map_location=map_location)
File "/home/pengtl/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 593, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/home/pengtl/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 762, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.
The text was updated successfully, but these errors were encountered: