Skip to content

solve the default 'template_backend' bug in llm.tempalte.base.Templte._encode #4669

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hzg0601
Copy link

@hzg0601 hzg0601 commented Jun 23, 2025

solve the template_backend bug: the correct default should be jinja rather than swift

PR type

  • [✅] Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

The default template_backend in llm.tempalte.base.Templte._encode should be jinja rather than swift, however, becuase the self.template_meta.template_type in a specific Template class are derived from MLLMTemplateType or LLMTemplateType, which is a specific type(e.g, ovis2) rather than 'dummy', the template_backend is always 'swift'.

Experiment results

Paste your experiment result here(if needed).
the prompt in vllm when inferring ovis:
企业微信截图_17506653559250

the prompt in swift:
企业微信截图_17506654012609

solve the template_backend bug: the correct default should be jinja rather than swift
@hzg0601
Copy link
Author

hzg0601 commented Jun 23, 2025

image
one can print these params to verify this PR

@Jintao-Huang
Copy link
Collaborator

Jintao-Huang commented Jun 23, 2025

Hello 😊, what model is this? Why are there spaces between the tokens?

I feel like this is actually the core issue here.

By default, the template_backend should be "swift"; "jinja" needs to be set manually, since some models do not support the jinja template_backend.

@Jintao-Huang
Copy link
Collaborator

You are Qwen, created by Alibaba Cloud. You are a helpful assistant.

This system message is not accurate.

@Jintao-Huang Jintao-Huang added the bug Something isn't working label Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants