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

Automatically convert heads when loading with XAdapterModel #594

Merged
merged 7 commits into from
Nov 11, 2023

Conversation

calpt
Copy link
Member

@calpt calpt commented Oct 17, 2023

Related to #592.
Changes loading logic of XAdapterModel classes such that static heads of loaded checkpoint will be automatically converted.
E.g.

model = AutoAdapterModel.from_pretrained("bert-base-uncased")

print(model.heads)

should automatically create a masked-LM head using the weights of the original head from the pre-trained checkpoint.

@calpt
Copy link
Member Author

calpt commented Oct 26, 2023

There's currently still an open issue for models such as BERT, where the LM head bias is not correctly loaded:

from adapters import AutoAdapterModel

model, loading_info = AutoAdapterModel.from_pretrained("bert-base-uncased", output_loading_info=True)
print(model.heads)
print(loading_info)

The cause of this issue is unrelated to the current changes.

@calpt calpt marked this pull request as ready for review October 26, 2023 20:58
Copy link
Member

@lenglaender lenglaender left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid to me 👍

@calpt calpt merged commit 6ae327a into adapter-hub:adapters Nov 11, 2023
5 checks passed
@calpt calpt deleted the dev/auto_load_flex_head branch November 11, 2023 11:18
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

Successfully merging this pull request may close these issues.

2 participants