Skip to content

Ensure llm-blender is importable with transformers >= v5#4781

Merged
albertvillanova merged 3 commits intohuggingface:mainfrom
albertvillanova:fix-4597
Jan 8, 2026
Merged

Ensure llm-blender is importable with transformers >= v5#4781
albertvillanova merged 3 commits intohuggingface:mainfrom
albertvillanova:fix-4597

Conversation

@albertvillanova
Copy link
Copy Markdown
Member

This PR introduces a compatibility workaround for importing llm_blender when using newer versions of transformers. The main change is the addition of a shim to prevent import errors due to an upstream issue, ensuring smoother integration until the dependency is fixed.

Fix #4597.

Compatibility workaround for llm-blender import:

  • Added _ensure_llm_blender_importable() helper to set a dummy TRANSFORMERS_CACHE attribute in transformers.utils.hub for versions >= 5.0.0.dev0, preventing import errors with llm_blender.
  • Updated PairRMJudge.__init__ to call the new shim before importing llm_blender, ensuring reliable initialization.

@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

@qgallouedec qgallouedec left a comment

Choose a reason for hiding this comment

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

thanks!

@albertvillanova albertvillanova merged commit fa57b5d into huggingface:main Jan 8, 2026
3 checks passed
marcandrelarochelle pushed a commit to marcandrelarochelle/trl that referenced this pull request Mar 25, 2026
…#4781)

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <gallouedec.quentin@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.

CI fails with dev dependencies: ImportError: cannot import name 'TRANSFORMERS_CACHE' from 'transformers.utils.hub'

3 participants