Skip to content

Support specify template in OpenAI server #1263

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

Closed
wants to merge 2 commits into from

Conversation

kai01ai
Copy link

@kai01ai kai01ai commented Oct 5, 2023

Currently, the OpenAI API server uses request.model as the template name. This approach isn't convenient when deploying custom models (e.g., a custom fine-tuned chat model that uses the chatgpt/llama2 template).

This patch addresses the issue by introducing a template field in the CompletionRequest/ChatCompletionRequest. If the template field isn't specified, it will default to the value of model to maintain backward compatibility.

@Tostino
Copy link
Contributor

Tostino commented Oct 9, 2023

Well, it looks like we are working on somewhat related features. Not exactly the same thing, but these would be incompatible if both PRs were accepted right now.

#1294

@kai01ai
Copy link
Author

kai01ai commented Oct 9, 2023

@Tostino Your implementation does offer more flexibility. However, I personally prefer using Prompt templating introduced in transformers 4.34.0. This would allow us to not rely on fastchat and to create custom templates stored in the tokenizer config files. Admittedly, this represents a significant change.

@Tostino
Copy link
Contributor

Tostino commented Oct 9, 2023

Right. I agree something like that is a much better solution...but I am unable to use my model with vLLM right now without patching it, and that was the solution that was suggested to me in Discord, so I went with it and submitted a PR because it is useful "right now". I'd expect it to be replaced when an implementation of HF prompt templates is in place, and I very much look forward to this madness being solved.

@Tostino
Copy link
Contributor

Tostino commented Oct 16, 2023

Just FYI, I am going to work on a PR for supporting the HF tokenizer prompt templating. Closed my other one since it hadn't been accepted yet.

@kai01ai
Copy link
Author

kai01ai commented Oct 16, 2023

Very nice! I will close this PR since the HF tokenizer prompt templating work

@kai01ai
Copy link
Author

kai01ai commented Dec 4, 2023

Closed due to #1756. Many thanks to @Tostino for the contribution.

@kai01ai kai01ai closed this Dec 4, 2023
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.

2 participants