-
Notifications
You must be signed in to change notification settings - Fork 389
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
Fix download model #490
Fix download model #490
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
classification_head.pth
seems to be missing in the download, too, doesn't it?
Yes, you are completely right, I fixed it |
…io into max/fix_download_model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
I think the model_card.md doesn't take into account the option to have multiple classes and will always assume a (1, 1) linear layer, but this is unrelated to this PR (so also wrong about input shape actually)
# settings can be arbitrary here as we overwrite with saved weights
head = torch.nn.Linear(1, 1, bias=False).to("cuda")
head.weight.data = head_weights
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
out = model(**inputs).logits
logits = head(out[:,-1])
Yeah, I was also confused, but it is actually ok, |
Make Download Model functionality robust against various model backbones/tokenizers.
tokenizer.save_pretrained
Fixes #489