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

Class BaseAdapter

toolbench/model/model_adapter.py:28–42  ·  view source on GitHub ↗

The base and the default model adapter.

Source from the content-addressed store, hash-verified

26
27
28class BaseAdapter:
29 """The base and the default model adapter."""
30
31 def match(self, model_path: str):
32 return True
33
34 def load_model(self, model_path: str, from_pretrained_kwargs: dict):
35 tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
36 model = AutoModelForCausalLM.from_pretrained(
37 model_path, low_cpu_mem_usage=True, **from_pretrained_kwargs
38 )
39 return model, tokenizer
40
41 def get_default_conv_template(self, model_path: str) -> Conversation:
42 return get_conv_template("one_shot")
43
44
45# A global registry for all model adapters

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected