Commit
·
228ade5
1
Parent(s):
b58d977
Ensure model has chat template
Browse files
backend/app/services/models.py
CHANGED
@@ -543,6 +543,17 @@ class ModelService(HuggingFaceService):
|
|
543 |
raise Exception(error)
|
544 |
logger.info(LogFormatter.success("Model on hub validation passed"))
|
545 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
# Validate model card
|
547 |
valid, error, model_card = await self.validator.check_model_card(
|
548 |
model_data["model_id"]
|
|
|
543 |
raise Exception(error)
|
544 |
logger.info(LogFormatter.success("Model on hub validation passed"))
|
545 |
|
546 |
+
# Validate that the model has a chat template
|
547 |
+
has_chat_template = hasattr(model_info, "chat_template") and model_info.chat_template is not None
|
548 |
+
if not has_chat_template:
|
549 |
+
logger.error(
|
550 |
+
LogFormatter.error(
|
551 |
+
"Model does not have a chat template"
|
552 |
+
)
|
553 |
+
)
|
554 |
+
raise Exception(
|
555 |
+
"Model does not have a chat template. Chat templates are required to accurately evaluate responses")
|
556 |
+
|
557 |
# Validate model card
|
558 |
valid, error, model_card = await self.validator.check_model_card(
|
559 |
model_data["model_id"]
|