MCPcopy Create free account
hub / github.com/OpenBMB/ToolBench / ToolLlamaAdapter

Class ToolLlamaAdapter

toolbench/model/model_adapter.py:249–265  ·  view source on GitHub ↗

Model adapater for tool-llama

Source from the content-addressed store, hash-verified

247
248
249class ToolLlamaAdapter(BaseAdapter):
250 "Model adapater for tool-llama"
251
252 def match(self, model_path: str):
253 return "tool-llama" == model_path
254
255 def load_model(self, model_path: str, from_pretrained_kwargs: dict):
256 tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
257 model = AutoModelForCausalLM.from_pretrained(
258 model_path,
259 low_cpu_mem_usage=True,
260 **from_pretrained_kwargs,
261 )
262 return model, tokenizer
263
264 def get_default_conv_template(self, model_path: str) -> Conversation:
265 return get_conv_template("tool-llama")
266
267class ToolLlamaAdapterSingleRound(BaseAdapter):
268 "Model adapater for tool-llama-single-round"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected