-
Notifications
You must be signed in to change notification settings - Fork 101
Reverse Chat Template Fallback Order #963
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a clean-up for some specialized handling in case that minja works, so we keep codes clean?
You mean like this: https://github.com/microsoft/onnxruntime-extensions/pull/963/files#diff-660d41852d9740562f27b085a10a08b04b635625f45367300c30206c907b3f5aR816, or something more? If Minja works, we get a chat template This PR simply switches fallback order plus any respective changes needed and ensures the status is returned correctly, it shouldn't make the code messier. |
…sions into sayanshaw/chat-tmpl-fallback-order
What I meant is to remove a model specific code in the file like TokenizerImpl::Phi3_5ChatTemplate if minja works fine with Phi3.5 chat template. We don't need to do it in this PR, but I'd like to know this makes sense and we can clean up unnecessary codes. |
Oh I see, sorry did not understand what you meant before - yes absolutely we should, but I want to implement multimodal support and run some tests before we do, in case we need some of the TokenizerImpl functions to add on to model-agnostic multimodal support. Like you said, can do that in a separate PR once multimodal work is sorted. |
text = root->render(context); | ||
output = text; | ||
} catch (const std::runtime_error& e) { | ||
if (model_to_template_map.count(activated_str)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any test cases to catch exception due to minja failure?
This change now ensures we try to parse the chat template with Minja first, and then falls back on the native implementation.