args: default --model to models/ + filename from --model-url or --hf-file (or else legacy models/7B/ggml-model-f16.gguf)
This commit is contained in:
parent
46e12c4692
commit
40a961db60
2 changed files with 20 additions and 4 deletions
|
@ -1338,9 +1338,25 @@ bool gpt_params_parse_ex(int argc, char ** argv, gpt_params & params) {
|
||||||
throw std::invalid_argument("error: --prompt-cache-all not supported in interactive mode yet\n");
|
throw std::invalid_argument("error: --prompt-cache-all not supported in interactive mode yet\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// short-hand to avoid specifying --hf-file -> default it to --model
|
if (!params.hf_repo.empty()) {
|
||||||
if (!params.hf_repo.empty() && params.hf_file.empty()) {
|
// short-hand to avoid specifying --hf-file -> default it to --model
|
||||||
params.hf_file = params.model;
|
if (params.hf_file.empty()) {
|
||||||
|
if (params.model.empty()) {
|
||||||
|
throw std::invalid_argument("error: --hf-repo requires either --hf-file or --model\n");
|
||||||
|
}
|
||||||
|
params.hf_file = params.model;
|
||||||
|
} else if (params.model.empty()) {
|
||||||
|
params.model = "models/" + string_split(params.hf_file, '/').back();
|
||||||
|
}
|
||||||
|
} else if (!params.model_url.empty()) {
|
||||||
|
if (params.model.empty()) {
|
||||||
|
auto f = string_split(params.model_url, '#').front();
|
||||||
|
f = string_split(f, '?').front();
|
||||||
|
f = string_split(f, '/').back();
|
||||||
|
params.model = "models/" + f;
|
||||||
|
}
|
||||||
|
} else if (params.model.empty()) {
|
||||||
|
params.model = "models/7B/ggml-model-f16.gguf";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.escape) {
|
if (params.escape) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ struct gpt_params {
|
||||||
// // sampling parameters
|
// // sampling parameters
|
||||||
struct llama_sampling_params sparams;
|
struct llama_sampling_params sparams;
|
||||||
|
|
||||||
std::string model = "models/7B/ggml-model-f16.gguf"; // model path
|
std::string model = ""; // model path
|
||||||
std::string model_draft = ""; // draft model for speculative decoding
|
std::string model_draft = ""; // draft model for speculative decoding
|
||||||
std::string model_alias = "unknown"; // model alias
|
std::string model_alias = "unknown"; // model alias
|
||||||
std::string model_url = ""; // model url to download
|
std::string model_url = ""; // model url to download
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue