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

Add proper jinja2 error #35533

Merged
merged 3 commits into from
Jan 16, 2025
Merged

Add proper jinja2 error #35533

merged 3 commits into from
Jan 16, 2025

Conversation

Rocketknight1
Copy link
Member

@Rocketknight1 Rocketknight1 commented Jan 6, 2025

Several users reported confusion in #34397 when jinja2 is not installed, because the code imports some submodules of jinja2, and the error message when these submodules is undefined doesn't reference jinja2 at all.

This PR adds a proper error so people know what's going on!

@Rocketknight1 Rocketknight1 changed the title Cleanup jinja2 imports Add proper jinja2 error Jan 6, 2025
@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.

@Rocketknight1
Copy link
Member Author

failing test is unrelated, pinging @ArthurZucker for core maintainer review!

Copy link
Member

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

LGTM 👍

(should we add jinja2 to some of the extras? I'm sure it gets installed with pip install transformers[all])

@Rocketknight1
Copy link
Member Author

It's a dependency of torch so it gets installed almost all of the time anyway, but maybe we should just give up and make it a full dependency of transformers at some point

@Rocketknight1 Rocketknight1 merged commit 1302c32 into main Jan 16, 2025
25 of 26 checks passed
@Rocketknight1 Rocketknight1 deleted the cleanup_jinja_imports branch January 16, 2025 15:31
bursteratom pushed a commit to bursteratom/transformers that referenced this pull request Jan 31, 2025
* Cleanup jinja2 imports

* Raise a proper error if Jinja is missing

* make fixup
elvircrn pushed a commit to elvircrn/transformers that referenced this pull request Feb 13, 2025
* Cleanup jinja2 imports

* Raise a proper error if Jinja is missing

* make fixup
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