Skip to content
Merged
Changes from 1 commit
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
14 changes: 12 additions & 2 deletions common/preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ struct local_model {
std::string name;
std::string path;
std::string path_mmproj;
std::string path_mtp;
};

common_presets common_preset_context::load_from_models_dir(const std::string & models_dir) const {
Expand All @@ -395,10 +396,13 @@ common_presets common_preset_context::load_from_models_dir(const std::string & m
common_file_info model_file;
common_file_info first_shard_file;
common_file_info mmproj_file;
common_file_info mtp_file;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
common_file_info mtp_file;
common_file_info draft_file;

for (const auto & file : files) {
if (string_ends_with(file.name, ".gguf")) {
if (file.name.find("mmproj") != std::string::npos) {
mmproj_file = file;
} else if (file.name.find("mtp-") != std::string::npos) {
Comment thread
EZForever marked this conversation as resolved.
Outdated
mtp_file = file;
} else if (file.name.find("-00001-of-") != std::string::npos) {
first_shard_file = file;
} else {
Expand All @@ -410,7 +414,8 @@ common_presets common_preset_context::load_from_models_dir(const std::string & m
local_model model{
/* name */ name,
/* path */ first_shard_file.path.empty() ? model_file.path : first_shard_file.path,
/* path_mmproj */ mmproj_file.path // can be empty
/* path_mmproj */ mmproj_file.path, // can be empty
/* path_mtp */ mtp_file.path // can be empty
};
if (!model.path.empty()) {
models.push_back(model);
Expand All @@ -428,7 +433,8 @@ common_presets common_preset_context::load_from_models_dir(const std::string & m
local_model model{
/* name */ name,
/* path */ file.path,
/* path_mmproj */ ""
/* path_mmproj */ "",
/* path_mtp */ ""
};
models.push_back(model);
}
Expand All @@ -443,6 +449,10 @@ common_presets common_preset_context::load_from_models_dir(const std::string & m
if (!model.path_mmproj.empty()) {
preset.set_option(*this, "LLAMA_ARG_MMPROJ", model.path_mmproj);
}
if (!model.path_mtp.empty()) {
preset.set_option(*this, "LLAMA_ARG_SPEC_TYPE", "draft-mtp");
preset.set_option(*this, "LLAMA_ARG_SPEC_DRAFT_MODEL", model.path_mtp);
}
out[preset.name] = preset;
}

Expand Down