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

@@ -120,11 +120,14 @@ class ModelContainer:
self.prompt_template = get_template_from_file(template_name)
break
except OSError:
# Silently set the prompt template to none on a file lookup error
# The template couldn't be found in the user's filesystem
print(f"Could not find template file with name {prompt_template_name}.jinja")
self.prompt_template = None
# Catch all for template lookup errors
if self.prompt_template is None:
if self.prompt_template:
print(f"Using template {self.prompt_template.name} for chat completions.")
else:
print("Chat completions are disabled because a prompt template wasn't provided or auto-detected.")
# Set num of experts per token if provided