Fix TypeError when chat_template is None in VoxtralProcessor#45090
Closed
hkc5 wants to merge 1 commit intohuggingface:mainfrom
Closed
Fix TypeError when chat_template is None in VoxtralProcessor#45090hkc5 wants to merge 1 commit intohuggingface:mainfrom
hkc5 wants to merge 1 commit intohuggingface:mainfrom
Conversation
The VoxtralProcessor.apply_chat_template method was calling _get_template_variables(chat_template) without first checking if chat_template was None. This caused a TypeError when users called apply_chat_template without explicitly providing a chat_template, even when the processor had a default chat template configured. This fix adds the same chat_template resolution logic that exists in the base ProcessingMixin.apply_chat_template method, ensuring that: 1. If chat_template is None, it uses the processor's default template 2. If the processor has multiple templates, it uses the 'default' one 3. Proper error messages are shown if no template is available Fixes huggingface#45084
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: voxtral |
Member
|
Please don't just run your code agent on random issues! It just creates noise, and the maintainers can run a code agent themselves if they need to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #45084
The
VoxtralProcessor.apply_chat_templatemethod was calling_get_template_variables(chat_template)without first checking ifchat_templatewas None. This caused aTypeError: Can't compile non template nodeswhen users calledapply_chat_templatewithout explicitly providing a chat_template, even when the processor had a default chat template configured.Changes
This PR adds the same chat_template resolution logic that exists in the base
ProcessingMixin.apply_chat_templatemethod, ensuring that:Testing