MCPcopy
hub / github.com/lm-sys/FastChat / get_default_conv_template

Method get_default_conv_template

fastchat/model/model_adapter.py:662–673  ·  view source on GitHub ↗

Uses the conv template of the base model

(self, model_path: str)

Source from the content-addressed store, hash-verified

660 return model, tokenizer
661
662 def get_default_conv_template(self, model_path: str) -> Conversation:
663 """Uses the conv template of the base model"""
664 from peft import PeftConfig, PeftModel
665
666 config = PeftConfig.from_pretrained(model_path)
667 if "peft" in config.base_model_name_or_path:
668 raise ValueError(
669 f"PeftModelAdapter cannot load a base model with 'peft' in the name: {config.base_model_name_or_path}"
670 )
671 base_model_path = config.base_model_name_or_path
672 base_adapter = get_model_adapter(base_model_path)
673 return base_adapter.get_default_conv_template(config.base_model_name_or_path)
674
675
676class VicunaAdapter(BaseModelAdapter):

Callers

nothing calls this directly

Calls 2

get_model_adapterFunction · 0.85

Tested by

no test coverage detected