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-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": os.path.join(MODEL_PATH, "CodeLlama-13b-Instruct-hf"),
"codellama-13b-sql-sft": os.path.join(MODEL_PATH, "codellama-13b-sql-sft"), "codellama-13b-sql-sft": os.path.join(MODEL_PATH, "codellama-13b-sql-sft"),
# For test now # For test now
"opt-125m": os.path.join(MODEL_PATH, "opt-125m"), "opt-125m": os.path.join(MODEL_PATH, "opt-125m"),
} }

View File

@ -319,6 +319,7 @@ class Llama2Adapter(BaseLLMAdaper):
model.config.pad_token_id = tokenizer.pad_token_id model.config.pad_token_id = tokenizer.pad_token_id
return model, tokenizer return model, tokenizer
class CodeLlamaAdapter(BaseLLMAdaper): class CodeLlamaAdapter(BaseLLMAdaper):
"""The model adapter for codellama""" """The model adapter for codellama"""

View File

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

View File

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

View File

@ -217,6 +217,7 @@ class Llama2ChatAdapter(BaseChatAdpter):
class CodeLlamaChatAdapter(BaseChatAdpter): class CodeLlamaChatAdapter(BaseChatAdpter):
"""The model ChatAdapter for codellama .""" """The model ChatAdapter for codellama ."""
def match(self, model_path: str): def match(self, model_path: str):
return "codellama" in model_path.lower() return "codellama" in model_path.lower()