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

[HF] Add input embedding argument to HF model #442

Merged
merged 5 commits into from
Feb 9, 2024

Conversation

2015aroras
Copy link
Contributor

The trainers in HF seem to expect models to accept input embeddings directly as an alternative to input ids. This expectation caused this HF issue.

This PR adds an input embeddings argument to OLMo, and bypasses the input embedding layer when input embeddings are provided.

@@ -1137,6 +1137,7 @@ def get_alibi_attention_bias(self, seq_len: int, device: torch.device) -> torch.
def forward(
self,
input_ids: torch.LongTensor,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally I would make input_ids optional, but this would not be a fully backwards compatible change.

Copy link
Member

@epwalsh epwalsh left a comment

Choose a reason for hiding this comment

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

LGTM. Can you add an entry to the CHANGELOG?

@2015aroras 2015aroras merged commit 97296e6 into main Feb 9, 2024
11 checks passed
@2015aroras 2015aroras deleted the shanea/add-input-embedding-arg branch February 9, 2024 23:12
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.

None yet

2 participants