Skip to content

adds jais2 model support#42684

Merged
ArthurZucker merged 21 commits intohuggingface:mainfrom
sarathc-cerebras:add-jais2-model
Dec 17, 2025
Merged

adds jais2 model support#42684
ArthurZucker merged 21 commits intohuggingface:mainfrom
sarathc-cerebras:add-jais2-model

Conversation

@sarathc-cerebras
Copy link
Copy Markdown
Contributor

@sarathc-cerebras sarathc-cerebras commented Dec 7, 2025

What does this PR do?

Fixes # (issue)

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.

@Rocketknight1
Copy link
Copy Markdown
Member

Hi @sarathc-cerebras, thank you for the PR! The main thing missing is a conversion to modular format. You can look at the modular files for other models to see how it works, but it reduces the size of the PR a lot by importing duplicated code from other models.

@sarathc-cerebras
Copy link
Copy Markdown
Contributor Author

@Rocketknight1 thanks for bringing this up, i have updated it to use the modular format

@sarathc-cerebras sarathc-cerebras force-pushed the add-jais2-model branch 4 times, most recently from 2ae7204 to 672e38a Compare December 9, 2025 14:13
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

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.

Copy link
Copy Markdown
Member

@Rocketknight1 Rocketknight1 left a comment

Choose a reason for hiding this comment

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

Yes, this looks good! I made a few comments but they're small.

Comment thread src/transformers/models/jais2/modular_jais2.py Outdated
Comment thread docs/source/en/model_doc/jais2.md Outdated
Comment thread tests/models/jais2/test_modeling_jais2.py Outdated
Comment thread docs/source/en/model_doc/jais2.md Outdated
Copy link
Copy Markdown
Contributor

@vasqu vasqu left a comment

Choose a reason for hiding this comment

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

Left some comments, I think we can still simplify a bit and update a few things to be up to date with our current standards. Overall, looking really good already tho

Comment thread docs/source/en/model_doc/jais2.md Outdated
Comment thread docs/source/en/model_doc/jais2.md
Comment thread docs/source/en/model_doc/jais2.md
Comment thread src/transformers/models/auto/configuration_auto.py
Comment thread src/transformers/models/jais2/__init__.py
Comment thread src/transformers/models/jais2/modular_jais2.py Outdated
Comment thread src/transformers/models/jais2/modular_jais2.py Outdated
Comment thread tests/models/jais2/test_modeling_jais2.py Outdated
Comment thread tests/models/jais2/test_modeling_jais2.py Outdated
Comment thread tests/models/jais2/test_modeling_jais2.py
Copy link
Copy Markdown
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.

LGTM good review @vasqu small nits but let's go!

Comment thread tests/models/jais2/test_modeling_jais2.py
generated_text = self.tokenizer.decode(generated_ids[0], skip_special_tokens=True)
print(f"Static cache generated text: {generated_text}")

self.assertGreater(generated_ids.shape[1], input_ids.shape[1])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

would be better to have explicit expected outputs here!

Copy link
Copy Markdown
Contributor

@vasqu vasqu left a comment

Choose a reason for hiding this comment

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

Please check out the comments from the last review, mostly nits otherwise and let's make the tests more explicit (I've linked an example in one of the review comments)

Comment thread src/transformers/models/jais2/__init__.py Outdated
Comment thread tests/models/jais2/test_modeling_jais2.py Outdated
Comment thread tests/models/jais2/test_modeling_jais2.py
Comment thread src/transformers/models/jais2/modular_jais2.py
Comment thread tests/models/jais2/test_modeling_jais2.py
Copy link
Copy Markdown
Contributor

@vasqu vasqu left a comment

Choose a reason for hiding this comment

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

Last comments from my side (I hope), small fixes and finishing touches

Comment thread src/transformers/models/jais2/modular_jais2.py Outdated
Comment thread src/transformers/models/jais2/modular_jais2.py Outdated
Comment thread src/transformers/models/jais2/modular_jais2.py Outdated
Comment thread src/transformers/models/jais2/modular_jais2.py Outdated
Comment thread src/transformers/models/jais2/modular_jais2.py
Comment thread tests/models/jais2/test_modeling_jais2.py Outdated
sarathc-cerebras and others added 12 commits December 16, 2025 12:01
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
sarathc-cerebras and others added 5 commits December 16, 2025 12:01
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
@vasqu
Copy link
Copy Markdown
Contributor

vasqu commented Dec 16, 2025

run-slow: jais2

@github-actions
Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: auto, jais2

@github-actions
Copy link
Copy Markdown
Contributor

This comment contains run-slow, running the specified jobs:

models: ["models/jais2"]
quantizations: []

@github-actions
Copy link
Copy Markdown
Contributor

CI Results

Workflow Run ⚙️

✅ No failing test specific to this PR 🎉 !

@vasqu vasqu enabled auto-merge (squash) December 16, 2025 13:48
@github-actions
Copy link
Copy Markdown
Contributor

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=42684&sha=8860cb

@sarathc-cerebras
Copy link
Copy Markdown
Contributor Author

do i need to do anything else for PR to be merged @vasqu or it will be merged from one of the reviewers?

@ArthurZucker ArthurZucker merged commit 0dbf808 into huggingface:main Dec 17, 2025
22 of 25 checks passed
@vasqu
Copy link
Copy Markdown
Contributor

vasqu commented Dec 17, 2025

@sarathc-cerebras merged now, sorry about that. The CI blocked but it isn't related to your PR 🤗

SangbumChoi pushed a commit to SangbumChoi/transformers that referenced this pull request Jan 23, 2026
* adds jais2 model support

* updates tests

* addresses review comment

* review comments addressed

* addresses test review comments

* fixes date

* format issue fix

* Update src/transformers/models/jais2/__init__.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/jais2/modular_jais2.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update tests/models/jais2/test_modeling_jais2.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/jais2/modular_jais2.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/jais2/modular_jais2.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/jais2/modular_jais2.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/jais2/modular_jais2.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/jais2/modular_jais2.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* fixes tests as per review comment

* updates layernorm setup

* Apply suggestions from code review

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* addressed review comments and updated tests as recomended

* fixup tests

---------

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
Co-authored-by: vasqu <antonprogamer@gmail.com>
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.

5 participants