deeppavlov / deeppavlov/AutoIntent

Upgrade transformers to 5.x (drops conftest mistral monkey-patch)

Open
#295 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
54
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Background

tests/conftest.py currently monkey-patches transformers.PreTrainedTokenizerBase._patch_mistral_regex to a no-op as a workaround for a confirmed transformers bug: on every tokenizer load with vocab_size > 100000 (e.g. our default intfloat/multilingual-e5-*), the method calls huggingface_hub.model_info() unconditionally. On CI that hammers the 1000-req/5-min HF rate limit and 429s.

Upstream issues / PRs documenting the bug:

  • huggingface/transformers#44843
  • huggingface/transformers#43200
  • huggingface/transformers#45545
  • huggingface/transformers#45444
  • huggingface/transformers#43603

The #45444 merge commit message explicitly says:

faulty mistral tokenizers saved with version 4.57.{3,4,5,6} will load incorrectly... use 5.0.0 as 5.0.0rc0 introduced the fix... Exclusively check for mistral BEFORE v5

So:

  • transformers 4.57.x has the bug — we're on 4.57.6, confirmed buggy
  • transformers 5.0.0+ has the fix — latest is 5.10.2 (released yesterday)
  • The fix was not backported to 4.x — it's "v5-only" by design

Task

Upgrade transformers to >=5.0 in pyproject.toml, then delete _disable_transformers_mistral_regex_patch() from tests/conftest.py.

Risk

transformers 5.0 is a major version bump (Mistral 4 support, removed deprecated APIs, etc). Likely surfaces breaking changes elsewhere in the codebase that would need addressing separately.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pyproject.toml and tests/conftest.py: inspect the transformers dependency and _disable_transformers_mistral_regex_patch() helper, then review the linked upstream issue context. Upgrade transformers to >=5.0, remove the helper, and run the project tests to identify regressions from the major version change. Done means the workaround is gone, the dependency is upgraded, and tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
huggingface, python
Domain
machine-learning, testing-qa
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.