Skip to content

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

hxdtest and others added 3 commits February 15, 2024 16:10
Co-authored-by: 玄钛 <hanxudong.hxd@antgroup.com>
Co-authored-by: Pete <epwalsh10@gmail.com>
Co-authored-by: epwalsh <petew@allenai.org>
@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
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