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 strftime_now callable function for minijinja chat templates #2983

Merged
merged 3 commits into from
Feb 3, 2025

Conversation

alvarobartt
Copy link
Member

@alvarobartt alvarobartt commented Jan 31, 2025

What does this PR do?

This PR adds the strftime_now callable function supported by the Hugging Face chat templates as per https://huggingface.co/docs/transformers/en/chat_templating#callable-functions, which was not yet supported on TGI.

It was leading to some models fail, such as the recent Mistral Small models i.e. https://huggingface.co/mistralai/Mistral-Small-24B-Base-2501 and https://huggingface.co/mistralai/Mistral-Small-24B-Instruct-2501, because the callable was not supported.

Thanks to @andrewrreed for reporting internall!

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline, Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the documentation guidelines, and here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@OlivierDehaene OR @Narsil

@alvarobartt alvarobartt changed the title Add chrono and strftime_now function callable Add strftime_now callable function Jan 31, 2025
@alvarobartt alvarobartt changed the title Add strftime_now callable function Add strftime_now callable function for minijinja chat templates Jan 31, 2025
Copy link
Contributor

@kldzj kldzj left a comment

Choose a reason for hiding this comment

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

Necessary to get the Mistral Small 24b running out of the box.

Copy link
Collaborator

@Narsil Narsil left a comment

Choose a reason for hiding this comment

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

LGTM

@Narsil Narsil merged commit 88fd56f into main Feb 3, 2025
19 checks passed
@Narsil Narsil deleted the template-callable-handling branch February 3, 2025 14:30
danieldk pushed a commit that referenced this pull request Feb 4, 2025
…2983)

* Add `chrono` and `strftime_now` function callable

* Fix `test_chat_template_valid_with_strftime_now`

* Fix `test_chat_template_valid_with_strftime_now`
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