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

[docs] update input documentation for MAMBA2 and MISTRAL models to include cache_position and attention_mask details #34322

Merged

Conversation

h3110Fr13nd
Copy link
Contributor

What does this PR do?

Mamba2 and Mistral models had Input docstrings not exactly matching with forwrd pass of their respective models.
This doesn't have a big impact.
But I'm trying to add modular models. Which I'm subclassing from Mistral. #33916
And documentation mismatch is somehow not overriding. Which seems to be a lacking in Mistral model.

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?

@stevhliu

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.

@h3110Fr13nd
Copy link
Contributor Author

h3110Fr13nd commented Oct 22, 2024

Also, in modelling_mistral.py there's a typo in input docstring

attention_mask
              ...
-            If `past_key_values` is used, optionally only the last `decoder_input_ids` have to be input (see
+            If `past_key_values` is used, optionally only the last `input_ids` have to be input (see
            `past_key_values`).

as suggested by docs of past_key_values and the forward args

past_key_values
            ...
            If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't
            have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`
            of shape `(batch_size, sequence_length)`.

@stevhliu

Copy link
Member

@stevhliu stevhliu 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 update :)

If you can rebase on main, that should fix the failing CI tests.

src/transformers/models/mistral/modeling_mistral.py Outdated Show resolved Hide resolved
@h3110Fr13nd h3110Fr13nd force-pushed the docs/fix-input-docstring-mamba2-mistral branch from d9c7406 to 6434c89 Compare October 25, 2024 17:13
@h3110Fr13nd h3110Fr13nd force-pushed the docs/fix-input-docstring-mamba2-mistral branch from 6434c89 to e73d151 Compare October 25, 2024 17:18
@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.

@stevhliu stevhliu merged commit fc1ae7f into huggingface:main Oct 28, 2024
11 checks passed
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
…clude cache_position and attention_mask details (huggingface#34322)

* [docs] update input documentation for MAMBA2 and MISTRAL models to include cache_position and attention_mask details

* [docs] correct input documentation for MISTRAL model to reference `input_ids` instead of `decoder_input_ids`

* [docs] clarify cache_position description in MISTRAL model documentation
BernardZach pushed a commit to innovationcore/transformers that referenced this pull request Dec 6, 2024
…clude cache_position and attention_mask details (huggingface#34322)

* [docs] update input documentation for MAMBA2 and MISTRAL models to include cache_position and attention_mask details

* [docs] correct input documentation for MISTRAL model to reference `input_ids` instead of `decoder_input_ids`

* [docs] clarify cache_position description in MISTRAL model documentation
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.

3 participants