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

add capability to output intermediate hidden states #451

Merged
merged 12 commits into from
Feb 16, 2024

Conversation

sarahwie
Copy link
Contributor

@sarahwie sarahwie commented Feb 13, 2024

Add a functionality that HF model forward calls have.
A very similar update can be done to add the output_attentions functionality, though I haven't written it yet.

Note that HF code "appends" hidden states to a tuple object, but I'm using a list as I think it's better practice. Hence the type casting in the function output to return a tuple, in order to match expected output in HF's convention.

@natolambert
Copy link
Contributor

Have you tested this @sarahwie ? Looks close to what I would expect but I don't use the OLMo repo much :)

@AkshitaB
Copy link
Contributor

Hi @sarahwie this is great! Do you mind also adding the use of the two flags to the HF wrapper here: https://github.com/allenai/OLMo/blob/main/hf_olmo/modeling_olmo.py#L48

@sarahwie
Copy link
Contributor Author

I've tested this locally but haven't re-built the pip package, let me try that to make sure it still works as expected @natolambert

@sarahwie
Copy link
Contributor Author

Temporarily added code to throw an error if output_attentions=True (#449) since that functionality hasn't been coded yet as @natolambert pointed out.

Tested this, and everything is worked as expected. Should I merge?

@natolambert
Copy link
Contributor

@sarahwie probably, but I'm not a core contributor. If you changed a bunch more, you can ask @AkshitaB to review the recent changes.

@sarahwie sarahwie merged commit 7f7abbb into allenai:main Feb 16, 2024
11 checks passed
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.

6 participants