Skip to content

Load Timm ViT model weights to huggingface ViT implementation #1810

Answered by rwightman
anjali-chadha asked this question in Q&A
Discussion options

You must be logged in to vote

@anjali-chadha there is a conversion script in transformers, not sure it's up to date with the latest but should be minimal changes to make it work if out of date https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit/convert_vit_timm_to_pytorch.py

Not all timm vit models will have equivalent arch in transformers, there are some variations would need code additions on the transformer side. Most of the main ones would work though. Beware that norm epsilon tends to be wrong in many transformers vit model configs, it's 1e-6 not 1e-12.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by anjali-chadha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants