Skip to content

Fix TypeError when chat_template is None in VoxtralProcessor#45090

Closed
hkc5 wants to merge 1 commit intohuggingface:mainfrom
hkc5:main
Closed

Fix TypeError when chat_template is None in VoxtralProcessor#45090
hkc5 wants to merge 1 commit intohuggingface:mainfrom
hkc5:main

Conversation

@hkc5
Copy link
Copy Markdown

@hkc5 hkc5 commented Mar 29, 2026

Description

Fixes #45084

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: Can't compile non template nodes when users called apply_chat_template without 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_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

Testing

  • Verified the fix with a test script that confirms the resolution logic is in place
  • The fix follows the same pattern used in the base ProcessingMixin class

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
@github-actions
Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: voxtral

@Rocketknight1
Copy link
Copy Markdown
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: Can't compile non template nodes

2 participants