@@ -301,6 +301,8 @@ static handle_model_result common_params_handle_model(struct common_params_model
301301 const common_download_opts & opts) {
302302 handle_model_result result;
303303
304+ // TODO @ngxson : refactor this into a new common_model_download_context
305+
304306 if (!model.docker_repo .empty ()) {
305307 model.path = common_docker_resolve_model (model.docker_repo );
306308 } else if (!model.hf_repo .empty ()) {
@@ -396,7 +398,7 @@ static bool parse_bool_value(const std::string & value) {
396398// CLI argument parsing functions
397399//
398400
399- bool common_params_handle_models (common_params & params, llama_example curr_ex, common_download_callback * callback ) {
401+ bool common_params_handle_models (common_params & params, llama_example curr_ex, const common_params_handle_models_params & handle_params ) {
400402 const bool spec_type_draft_mtp = std::find (params.speculative .types .begin (),
401403 params.speculative .types .end (),
402404 COMMON_SPECULATIVE_TYPE_DRAFT_MTP ) != params.speculative .types .end ();
@@ -407,9 +409,10 @@ bool common_params_handle_models(common_params & params, llama_example curr_ex,
407409 opts.skip_download = params.skip_download ;
408410 opts.download_mtp = spec_type_draft_mtp;
409411 opts.download_mmproj = !params.no_mmproj && params.mmproj .path .empty () && params.mmproj .url .empty ();
412+ opts.preset_only = handle_params.preset_only ;
410413
411- if (callback) {
412- opts.callback = callback;
414+ if (handle_params. callback ) {
415+ opts.callback = handle_params. callback ;
413416 }
414417
415418 // sub-models (draft, mmproj, vocoder) are explicitly specified by the user,
@@ -596,7 +599,7 @@ static bool common_params_parse_ex(int argc, char ** argv, common_params_context
596599
597600 if (!skip_model_download) {
598601 // handle model and download
599- common_params_handle_models (params, ctx_arg.ex );
602+ common_params_handle_models (params, ctx_arg.ex , {} );
600603
601604 // model is required (except for server)
602605 // TODO @ngxson : maybe show a list of available models in CLI in this case
0 commit comments