add conv judge

This commit is contained in:
wangzaistone 2023-10-31 17:39:14 +08:00
parent 17e21a395b
commit 3233e260b2
5 changed files with 10 additions and 10 deletions

View File

@ -82,11 +82,6 @@ LLM_MODEL_CONFIG = {
"codellama-7b-sql-sft": os.path.join(MODEL_PATH, "codellama-7b-sql-sft"),
"codellama-13b": os.path.join(MODEL_PATH, "CodeLlama-13b-Instruct-hf"),
"codellama-13b-sql-sft": os.path.join(MODEL_PATH, "codellama-13b-sql-sft"),
# For test now
"opt-125m": os.path.join(MODEL_PATH, "opt-125m"),
}

View File

@ -319,8 +319,9 @@ class Llama2Adapter(BaseLLMAdaper):
model.config.pad_token_id = tokenizer.pad_token_id
return model, tokenizer
class CodeLlamaAdapter(BaseLLMAdaper):
"""The model adapter for codellama """
"""The model adapter for codellama"""
def match(self, model_path: str):
return "codellama" in model_path.lower()

View File

@ -360,7 +360,6 @@ register_conv_template(
)
# Alpaca default template
register_conv_template(
Conversation(

View File

@ -48,7 +48,7 @@ _OLD_MODELS = [
"codellama-13b-sql-sft",
"codellama-7b",
"codellama-7b-sql-sft",
"codellama-13b"
"codellama-13b",
]
@ -152,8 +152,12 @@ class LLMModelAdaper:
conv.append_message(conv.roles[1], content)
else:
raise ValueError(f"Unknown role: {role}")
if system_messages:
conv.set_system_message("".join(system_messages))
if isinstance(conv, Conversation):
conv.set_system_message("".join(system_messages))
else:
conv.update_system_message("".join(system_messages))
# Add a blank message for the assistant.
conv.append_message(conv.roles[1], None)

View File

@ -213,10 +213,11 @@ class Llama2ChatAdapter(BaseChatAdpter):
def get_conv_template(self, model_path: str) -> Conversation:
return get_conv_template("llama-2")
class CodeLlamaChatAdapter(BaseChatAdpter):
"""The model ChatAdapter for codellama ."""
def match(self, model_path: str):
return "codellama" in model_path.lower()