mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Add proper jinja2 error (#35533)
* Cleanup jinja2 imports * Raise a proper error if Jinja is missing * make fixup
This commit is contained in:
parent
3292e96a4f
commit
1302c32a84
@ -362,6 +362,11 @@ def _render_with_assistant_indices(
|
||||
|
||||
@lru_cache
|
||||
def _compile_jinja_template(chat_template):
|
||||
if not is_jinja_available():
|
||||
raise ImportError(
|
||||
"apply_chat_template requires jinja2 to be installed. Please install it using `pip install jinja2`."
|
||||
)
|
||||
|
||||
class AssistantTracker(Extension):
|
||||
# This extension is used to track the indices of assistant-generated tokens in the rendered chat
|
||||
tags = {"generation"}
|
||||
|
Loading…
Reference in New Issue
Block a user