Skip to content

LocalEntryNotFoundError when loading downloaded pretrained model using timm.create_model (side load offline weights, e.g. on Kaggle) #1826

Answered by rwightman
eesoymilk asked this question in Q&A
Discussion options

You must be logged in to vote

@eesoymilk latest timm versions (0.9.x) use the huggingface hub for weights by default now, that takes priority over the torch hub cache, many weights have been remapped for model changes so best download via HF hub. Kaggle really should support passing through HF hub or at least caching it properly but they seem to have no interest in making things simpler for people so the manual caching of weights in datasets madness continues...

To override pretrained location, you download the weights file manually from the hub and try the following.

timm.create_model(
  'swinv2_large_window12to16_192to256',
  pretrained=True,
  pretrained_cfg_overlay=dict(file='path/to/checkpoint'),
)

where checkpoi…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@eesoymilk
Comment options

@rwightman
Comment options

Answer selected by eesoymilk
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@K-D-Gallagher
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working
4 participants
Converted from issue

This discussion was converted from issue #1825 on May 25, 2023 03:53.