Skip to content
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

Cannot load custom config #5

Open
arkel23 opened this issue Dec 9, 2020 · 3 comments
Open

Cannot load custom config #5

arkel23 opened this issue Dec 9, 2020 · 3 comments

Comments

@arkel23
Copy link

arkel23 commented Dec 9, 2020

Hey! First of all, thanks for your contribution! I have looked at multiple ViT implementations and yours seems like the most straightforward, well-organized and simple to use.

I'd like to use your from_config method to initiate the model, but I get this error. I was looking everywhere and couldn't find any from_config method so that may be the problem?

from pytorch_pretrained_vit import ViT
# The following is equivalent to ViT('B_16')
config = dict(hidden_size=512, num_heads=8, num_layers=6)
model = ViT.from_config(config)

AttributeError: type object 'ViT' has no attribute 'from_config'

Also, I'm guessing that if you change anything in the config, the model would have to be retrained from scratch, since the pretrained weights wouldn't fit the model anymore, is that right?

And another thing is that you mention that those are equivalent to ViT('B_16') but in B_16 shouldnt the num_heads=12, and num_layers=12? And what is hidden_size=512 for? I cannot find any part in the code that refers to it.

Thanks in advance.

@arp95
Copy link

arp95 commented Apr 1, 2021

Is there an update on this? I cannot load the custom config ViT for my case.

@khawar-islam
Copy link

@arkel23 Did you train on some different datasets using VIT pre-trained model?

@arkel23
Copy link
Author

arkel23 commented May 19, 2021

@arkel23 Did you train on some different datasets using VIT pre-trained model?

Yes, I did. I trained some models for anime character face recognition on https://github.com/arkel23/animesion/tree/main/classification
using this repository as baseline for the ViT model and just added the training pipeline and the datasets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants