@@ -133,7 +133,8 @@ static void common_params_handle_model_default(
133
133
const std::string & model_url,
134
134
std::string & hf_repo,
135
135
std::string & hf_file,
136
- const std::string & hf_token) {
136
+ const std::string & hf_token,
137
+ const std::string & model_default) {
137
138
if (!hf_repo.empty ()) {
138
139
// short-hand to avoid specifying --hf-file -> default it to --model
139
140
if (hf_file.empty ()) {
@@ -163,7 +164,7 @@ static void common_params_handle_model_default(
163
164
model = fs_get_cache_file (string_split<std::string>(f, ' /' ).back ());
164
165
}
165
166
} else if (model.empty ()) {
166
- model = DEFAULT_MODEL_PATH ;
167
+ model = model_default ;
167
168
}
168
169
}
169
170
@@ -299,8 +300,9 @@ static bool common_params_parse_ex(int argc, char ** argv, common_params_context
299
300
}
300
301
301
302
// TODO: refactor model params in a common struct
302
- common_params_handle_model_default (params.model , params.model_url , params.hf_repo , params.hf_file , params.hf_token );
303
- common_params_handle_model_default (params.vocoder .model , params.vocoder .model_url , params.vocoder .hf_repo , params.vocoder .hf_file , params.hf_token );
303
+ common_params_handle_model_default (params.model , params.model_url , params.hf_repo , params.hf_file , params.hf_token , DEFAULT_MODEL_PATH);
304
+ common_params_handle_model_default (params.speculative .model , params.speculative .model_url , params.speculative .hf_repo , params.speculative .hf_file , params.hf_token , " " );
305
+ common_params_handle_model_default (params.vocoder .model , params.vocoder .model_url , params.vocoder .hf_repo , params.vocoder .hf_file , params.hf_token , " " );
304
306
305
307
if (params.escape ) {
306
308
string_process_escapes (params.prompt );
@@ -1629,6 +1631,13 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
1629
1631
params.hf_repo = value;
1630
1632
}
1631
1633
).set_env (" LLAMA_ARG_HF_REPO" ));
1634
+ add_opt (common_arg (
1635
+ {" -hfd" , " -hfrd" , " --hf-repo-draft" }, " <user>/<model>[:quant]" ,
1636
+ " Same as --hf-repo, but for the draft model (default: unused)" ,
1637
+ [](common_params & params, const std::string & value) {
1638
+ params.speculative .hf_repo = value;
1639
+ }
1640
+ ).set_env (" LLAMA_ARG_HFD_REPO" ));
1632
1641
add_opt (common_arg (
1633
1642
{" -hff" , " --hf-file" }, " FILE" ,
1634
1643
" Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)" ,
0 commit comments