Skip to content

Commit

Permalink
Render chat template tojson filter as unicode (huggingface#31041)
Browse files Browse the repository at this point in the history
* Render chat template tojson filter as unicode

* ruff--
  • Loading branch information
CISC authored and zucchini-nlp committed Jun 11, 2024
1 parent d2f0aa9 commit 37a6661
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/transformers/tokenization_utils_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1853,6 +1853,7 @@ def raise_exception(message):
raise TemplateError(message)

jinja_env = ImmutableSandboxedEnvironment(trim_blocks=True, lstrip_blocks=True)
jinja_env.policies["json.dumps_kwargs"]["ensure_ascii"] = False
jinja_env.globals["raise_exception"] = raise_exception
return jinja_env.from_string(chat_template)

Expand Down

0 comments on commit 37a6661

Please sign in to comment.