Skip to content

Commit

Permalink
Add load_model
Browse files Browse the repository at this point in the history
  • Loading branch information
lerela committed Oct 2, 2023
1 parent bde1118 commit 56e1d4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions fastchat/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ def get_conv_template(name: str) -> Conversation:

# Mistral template
register_conv_template(
# source: https://docs.mistral.ai/llm/mistral-instruct-v0.1#chat-template
Conversation(
name="mistral",
system_template="",
Expand Down
7 changes: 5 additions & 2 deletions fastchat/model/model_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1257,13 +1257,16 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class MistralAdapter(BaseModelAdapter):
"""The model adapter for Mistral models"""
"""The model adapter for Mistral AI models"""

def match(self, model_path: str):
return "mistral" in model_path.lower()

def load_model(self, model_path: str, from_pretrained_kwargs: dict):
raise NotImplementedError()
model, tokenizer = super().load_model(model_path, from_pretrained_kwargs)
model.config.eos_token_id = tokenizer.eos_token_id
model.config.pad_token_id = tokenizer.pad_token_id
return model, tokenizer

def get_default_conv_template(self, model_path: str) -> Conversation:
return get_conv_template("mistral")
Expand Down

0 comments on commit 56e1d4c

Please sign in to comment.