From f1cce2d66371b58ae695f3f64dd3279815f01d80 Mon Sep 17 00:00:00 2001 From: HALIS-sh <412929301@qq.com> Date: Wed, 14 Aug 2024 10:24:40 +0800 Subject: [PATCH] Modify the formatter of function and observation --- contrib/tool-finetune/README.md | 8 ++++---- src/lmflow/utils/conversation_template/base.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/tool-finetune/README.md b/contrib/tool-finetune/README.md index 9bdb775ad..9d03420d6 100644 --- a/contrib/tool-finetune/README.md +++ b/contrib/tool-finetune/README.md @@ -1,6 +1,6 @@ ## Function-call Finetune -### Conda environment +### Pip dependency ``` bitsandbytes==0.40.0 @@ -70,6 +70,6 @@ xformers==0.0.27 ### Command-Line Arguments - `--model-name-or-path` - Specifies the name or path of the model used for -- `conversation_template` - So far supports the following choices: llama3_for_tool, qwen2_for_tool -- `dataset_path` - The path to the dataset that has been converted to the specified format -- `output_model_path` - Directory to store the finetuned model and logs \ No newline at end of file +- `--conversation_template` - So far supports the following choices: llama3_for_tool, qwen2_for_tool +- `--dataset_path` - The path to the dataset that has been converted to the specified format +- `--output_model_path` - Directory to store the finetuned model and logs \ No newline at end of file diff --git a/src/lmflow/utils/conversation_template/base.py b/src/lmflow/utils/conversation_template/base.py index e93afacd2..f0774ebc0 100644 --- a/src/lmflow/utils/conversation_template/base.py +++ b/src/lmflow/utils/conversation_template/base.py @@ -495,12 +495,12 @@ def _encode( ls_for_save.append(user_encoded) elif messages[i]['role'] == CONVERSATION_ROLE_NAMES['function']: function_message = messages[i] - function_formatted = self.assistant_formatter.format(content=function_message['content']) + function_formatted = self.function_formatter.format(content=function_message['content']) function_encoded = self._encode_template(function_formatted, tokenizer) ls_for_save.append(function_encoded) elif messages[i]['role'] == CONVERSATION_ROLE_NAMES['observation']: observation_message = messages[i] - observation_formatted = self.user_formatter.format(content=observation_message['content']) + observation_formatted = self.observation_formatter.format(content=observation_message['content']) observation_encoded = self._encode_template(observation_formatted, tokenizer) ls_for_save.append(observation_encoded) elif messages[i]['role'] == CONVERSATION_ROLE_NAMES['assistant']: