Skip to content

Commit

Permalink
Add minicpm3 4b FC model handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Cppowboy committed Oct 28, 2024
1 parent f64916e commit 23ba990
Show file tree
Hide file tree
Showing 6 changed files with 442 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -644,11 +644,17 @@
"Apache-2.0",
],
"openbmb/MiniCPM3-4B": [
"MiniCPM3-4B (FC)",
"MiniCPM3-4B (Prompt)",
"https://huggingface.co/openbmb/MiniCPM3-4B",
"openbmb",
"Apache-2.0",
],
"openbmb/MiniCPM3-4B-FC": [
"MiniCPM3-4B-FC (FC)",
"https://huggingface.co/openbmb/MiniCPM3-4B-FC",
"openbmb",
"Apache-2.0",
],
}

INPUT_PRICE_PER_MILLION_TOKEN = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,5 @@
"THUDM/glm-4-9b-chat",
"ibm-granite/granite-20b-functioncalling",
"yi-large-fc",
"openbmb/MiniCPM3-4B-FC",
]
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from bfcl.model_handler.oss_model.salesforce import SalesforceHandler
from bfcl.model_handler.oss_model.qwen import QwenHandler
from bfcl.model_handler.oss_model.minicpm import MiniCPMHandler
from bfcl.model_handler.oss_model.minicpm_fc import MiniCPMFCHandler
from bfcl.model_handler.proprietary_model.claude import ClaudeHandler
from bfcl.model_handler.proprietary_model.cohere import CohereHandler
from bfcl.model_handler.proprietary_model.databricks import DatabricksHandler
Expand Down Expand Up @@ -126,6 +127,7 @@
"Qwen/Qwen2.5-7B-Instruct": QwenHandler,
"Team-ACE/ToolACE-8B": LlamaHandler,
"openbmb/MiniCPM3-4B": MiniCPMHandler,
"openbmb/MiniCPM3-4B-FC": MiniCPMFCHandler,
}

# Deprecated/outdated models, no longer on the leaderboard
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from bfcl.model_handler.oss_model.base_oss_handler import OSSHandler


class MiniCPMHandler(OSSHandler):
def __init__(self, model_name, temperature) -> None:
super().__init__(model_name, temperature)
Expand All @@ -11,7 +12,9 @@ def _format_prompt(self, messages, function):
formatted_prompt = ""

for message in messages:
formatted_prompt += f"<|im_start|>{message['role']}\n{message['content']}<|im_end|>\n"
formatted_prompt += (
f"<|im_start|>{message['role']}\n{message['content']}<|im_end|>\n"
)

formatted_prompt += f"<|im_start|>assistant\n"

Expand Down
Loading

0 comments on commit 23ba990

Please sign in to comment.