-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Feature] support auto chat template #4949
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
Changes from all commits
b8c1a1c
72eb28c
c7d7a76
dd4d680
345e6fc
f219cf4
0f510f5
8bc4fae
28c40d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ | |
| chat_template_exists, | ||
| generate_chat_conv, | ||
| generate_embedding_convs, | ||
| get_conv_template_by_model_path, | ||
| register_conv_template, | ||
| ) | ||
| from sglang.srt.function_call_parser import FunctionCallParser | ||
|
|
@@ -163,10 +164,14 @@ def load_chat_template_for_openai_api(tokenizer_manager, chat_template_arg, mode | |
| else: | ||
| chat_template_name = chat_template_arg | ||
|
|
||
| # Check chat-template | ||
| # TODO: | ||
| # 1. Do not import any code from sglang.lang | ||
| # 2. For VLM, when chat_template_arg is None, set it automatically by guessing from model_path. | ||
|
|
||
| def guess_chat_template_name_from_model_path(model_path): | ||
| global chat_template_name | ||
| chat_template_name = get_conv_template_by_model_path(model_path) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi. If the model_path from
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @adarshxs hi adarshxs, can you adapt this from your last pr?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure will do the same
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hi @adarshxs, how is it going? can we prioritize this? thanks |
||
| if chat_template_name is not None: | ||
| logger.info( | ||
| f"Infer the chat template name from the model path and obtain the result: {chat_template_name}." | ||
| ) | ||
|
|
||
|
|
||
| async def v1_files_create( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.