Fix the Phi-3 template when used in the UI

This commit is contained in:
oobabooga 2024-04-24 01:34:11 -07:00
parent f0538efb99
commit 64e2a9a0a7

View File

@ -71,6 +71,7 @@ def get_model_metadata(model):
template = template.replace('bos_token', "'{}'".format(bos_token))
template = re.sub(r'raise_exception\([^)]*\)', "''", template)
template = re.sub(r'{% if add_generation_prompt %}.*', '', template, flags=re.DOTALL)
model_settings['instruction_template'] = 'Custom (obtained from model metadata)'
model_settings['instruction_template_str'] = template
@ -130,6 +131,7 @@ def get_model_metadata(model):
template = template.replace(k, "'{}'".format(value))
template = re.sub(r'raise_exception\([^)]*\)', "''", template)
template = re.sub(r'{% if add_generation_prompt %}.*', '', template, flags=re.DOTALL)
model_settings['instruction_template'] = 'Custom (obtained from model metadata)'
model_settings['instruction_template_str'] = template