The base and the default model adapter.
| 26 | |
| 27 | |
| 28 | class 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 |
nothing calls this directly
no outgoing calls
no test coverage detected