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

Class ToolLlamaAdapterSingleRound

toolbench/model/model_adapter.py:267–283  ·  view source on GitHub ↗

Model adapater for tool-llama-single-round

Source from the content-addressed store, hash-verified

265 return get_conv_template("tool-llama")
266
267class ToolLlamaAdapterSingleRound(BaseAdapter):
268 "Model adapater for tool-llama-single-round"
269
270 def match(self, model_path: str):
271 return "tool-llama-single-round" == model_path
272
273 def load_model(self, model_path: str, from_pretrained_kwargs: dict):
274 tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False, model_max_length=8192)
275 model = AutoModelForCausalLM.from_pretrained(
276 model_path,
277 low_cpu_mem_usage=True,
278 **from_pretrained_kwargs,
279 )
280 return model, tokenizer
281
282 def get_default_conv_template(self, model_path: str) -> Conversation:
283 return get_conv_template("tool-llama-single-round")
284
285
286# Note: the registration order matters.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected