Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal changes to get Mistral-7B-Instruct-v0.1 working #986

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cpp/conv_templates.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ Conversation Llama2() {
return conv;
}

Conversation MistralDefault() {
Conversation conv;
conv.name = "mistral_default";
conv.roles = {"[INST]", "[/INST]"};
conv.messages = {};
conv.offset = 0;
conv.separator_style = SeparatorStyle::kSepRoleMsg;
conv.seps = {" "};
conv.role_msg_sep = " ";
conv.role_empty_sep = " ";
conv.stop_tokens = {2};
conv.stop_str = "</s>";
conv.add_bos = true;
return conv;
}

Conversation CodeLlamaCompletion() {
Conversation conv;
conv.name = "codellama_completion";
Expand Down Expand Up @@ -546,6 +562,7 @@ Conversation Conversation::FromTemplate(const std::string& name) {
static std::unordered_map<std::string, ConvFactory> factory = {
{"llama_default", LlamaDefault},
{"llama-2", Llama2},
{"mistral_default", MistralDefault},
{"codellama_completion", CodeLlamaCompletion},
{"codellama_instruct", CodeLlamaInstruct},
{"vicuna_v1.1", VicunaV11},
Expand Down
2 changes: 2 additions & 0 deletions mlc_llm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,8 @@ def build_model_from_args(args: argparse.Namespace):
if not use_cache or args.convert_weight_only:
if args.model_category == "llama":
mod, param_manager, params, model_config = llama.get_model(args, config)
elif args.model_category == "mistral":
mod, param_manager, params, model_config = llama.get_model(args, config)
elif args.model_category == "gpt_neox":
mod, param_manager, params, model_config = gpt_neox.get_model(args, config)
elif args.model_category == "gpt_bigcode":
Expand Down
2 changes: 1 addition & 1 deletion mlc_llm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .transform import ReorderTransformFunc

supported_model_types = set(
["llama", "gpt_neox", "gpt_bigcode", "minigpt", "moss", "rwkv", "gptj", "chatglm"]
["llama", "gpt_neox", "gpt_bigcode", "minigpt", "moss", "rwkv", "gptj", "chatglm", "mistral"]
)


Expand Down