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 support for OLMo's November release #34497

Closed

Conversation

2015aroras
Copy link
Contributor

@2015aroras 2015aroras commented Oct 29, 2024

What does this PR do?

An updated OLMo model will be released in November. The new model has a few small architecture changes compared to the existing model in transformers:

  • RMSNorm is used instead of standard layer norm.
  • Norm is applied to attention queries and keys.
  • Norm is applied after attention/feedforward rather than before.

This PR updates the OLMo implementation in transformers to support the November release.

@ArthurZucker

Fixes #34496

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@2015aroras
Copy link
Contributor Author

Tested that an intermediate checkpoint can be converted and matches the original model (max logit diff <5e-5).

Tested that a random OLMo 1B checkpoint can still be converted and still matches the original model (max logit diff <5e-5).

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Thanks for the pr!
We should create a new model with https://huggingface.co/docs/transformers/en/modular_transformers 🤗

Comment on lines +273 to +282
self.q_norm = (
get_layer_norm(config.layer_norm_type, self.num_heads * self.head_dim, config.rms_norm_eps)
if config.use_q_norm
else None
)
self.k_norm = (
get_layer_norm(config.layer_norm_type, self.num_key_value_heads * self.head_dim, config.rms_norm_eps)
if config.use_k_norm
else None
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

hey! This goes a bit against the transformers philosophy: we never change an old model to support a new architecture! We need a Olmo2 model 🤗
with modular this should be fairly simple to implement!

Copy link
Contributor Author

@2015aroras 2015aroras Oct 30, 2024

Choose a reason for hiding this comment

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

Ok, I've re-implemented this new model as a new model using modular (original model unchanged). I'll put out the PR once we have decided on a suitable model name internally (we don't intend to call this release OLMo 2).

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@2015aroras
Copy link
Contributor Author

Making a fresh PR with modular transformers.

@2015aroras 2015aroras closed this Oct 31, 2024
@2015aroras 2015aroras mentioned this pull request Oct 31, 2024
5 tasks
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.

Add support for OLMo November release
3 participants