Templates: Add clarity statements

Lets the user know if a file not found (OSError) occurs and prints
the applied template on model load.

Also fix some remaining references to fastchat.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2023-12-19 08:13:04 -05:00
parent 0d76ed9b8b
commit 0a144688c6
2 changed files with 8 additions and 5 deletions

View File

@@ -14,10 +14,10 @@ class PromptTemplate(BaseModel):
def get_prompt_from_template(messages, prompt_template: PromptTemplate, add_generation_prompt: bool):
if version.parse(package_version("jinja2")) < version.parse("3.0.0"):
raise ImportError(
"Parsing these chat completion messages requires fastchat 0.2.23 or greater. "
"Parsing these chat completion messages requires jinja2 3.0.0 or greater. "
f"Current version: {version('jinja2')}\n"
"Please upgrade fastchat by running the following command: "
"pip install -U fschat[model_worker]"
"Please upgrade jinja by running the following command: "
"pip install --upgrade jinja2"
)
compiled_template = _compile_template(prompt_template.template)