Skip to content

Conversation

@kurzdev
Copy link

@kurzdev kurzdev commented May 3, 2025

What does this PR do?

Fixes #37930

Prior to this PR, compute_transition_scores, _get_candidate_generator and _get_logits_processor still used config.vocab_size to access a model's vocab size. This caused issues with multimodal models, as the vocab_size is stored within their text_config.
This PR addresses this issue by migrating these remaining accesses to vocab_size to config.get_text_config().vocab_size.

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?

@zucchini-nlp @gante

… `config.get_text_config().vocab.size`

In doing so, we enable multimodal models to fully leverage all existing generation features.
@github-actions github-actions bot marked this pull request as draft May 3, 2025 11:22
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2025

Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the Ready for review button (at the bottom of the PR page). This will assign reviewers and trigger CI.

@kurzdev kurzdev marked this pull request as ready for review May 3, 2025 11:23
@github-actions github-actions bot requested a review from gante May 3, 2025 11:23
Copy link
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me! I don't think assisted decoding works with VLMs yet, but oke, let's pass correct vocab size for now

Copy link
Contributor

@gante gante left a comment

Choose a reason for hiding this comment

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

Perfect, thank you for submitting this PR 🤗

@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.

@gante gante merged commit d80f53f into huggingface:main May 5, 2025
20 checks passed
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request May 14, 2025
…#37937)

Implements last migrations for generation from `config.vocab_size` to `config.get_text_config().vocab.size`

In doing so, we enable multimodal models to fully leverage all existing generation features.
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.

compute_transition_scores fails for vision-language models

4 participants