@@ -1160,7 +1160,7 @@ struct common_init_result::impl {
11601160 std::vector<llama_sampler_seq_config> samplers_seq_config;
11611161};
11621162
1163- common_init_result::common_init_result (common_params & params) :
1163+ common_init_result::common_init_result (common_params & params, bool model_only ) :
11641164 pimpl(new impl{}) {
11651165 auto mparams = common_model_params_to_llama (params);
11661166 auto cparams = common_context_params_to_llama (params);
@@ -1173,7 +1173,7 @@ common_init_result::common_init_result(common_params & params) :
11731173 params.tensor_buft_overrides .data (),
11741174 params.fit_params_target .data (),
11751175 params.fit_params_min_ctx ,
1176- params.verbosity >= 4 ? GGML_LOG_LEVEL_DEBUG : GGML_LOG_LEVEL_ERROR );
1176+ params.verbosity >= LOG_LEVEL_DEBUG ? GGML_LOG_LEVEL_DEBUG : GGML_LOG_LEVEL_ERROR );
11771177 }
11781178
11791179 llama_model * model = llama_model_load_from_file (params.model .path .c_str (), mparams);
@@ -1183,6 +1183,10 @@ common_init_result::common_init_result(common_params & params) :
11831183
11841184 pimpl->model .reset (model);
11851185
1186+ if (model_only) {
1187+ return ;
1188+ }
1189+
11861190 const llama_vocab * vocab = llama_model_get_vocab (model);
11871191
11881192 // load and optionally apply lora adapters
@@ -1252,29 +1256,6 @@ common_init_result::common_init_result(common_params & params) :
12521256 cparams.n_samplers = pimpl->samplers_seq_config .size ();
12531257 }
12541258
1255- // [TAG_RS_STATE_ROLLBACK_SUPPORT]
1256- // TODO: ngram speculative methods require checkpointing in addition to partial RS rollback
1257- // currently this is not supported. so we disable the partial rollback
1258- if (cparams.n_rs_seq > 0 && (llama_model_is_recurrent (model) || llama_model_is_hybrid (model))) {
1259- auto & types = params.speculative .types ;
1260-
1261- for (int i = 0 ; i < (int ) types.size (); i++) {
1262- if (types[i] == COMMON_SPECULATIVE_TYPE_NONE ) {
1263- continue ;
1264- }
1265- if (types[i] == COMMON_SPECULATIVE_TYPE_DRAFT_MTP ) {
1266- continue ;
1267- }
1268-
1269- cparams.n_rs_seq = 0 ;
1270-
1271- LOG_WRN (" %s: recurrent state rollback is not compatible with '%s' - disabling rollback support\n " , __func__,
1272- common_speculative_type_to_str (types[i]).c_str ());
1273-
1274- break ;
1275- }
1276- }
1277-
12781259 llama_context * lctx = llama_init_from_model (model, cparams);
12791260 if (lctx == NULL ) {
12801261 LOG_ERR (" %s: failed to create context with model '%s'\n " , __func__, params.model .path .c_str ());
@@ -1309,15 +1290,19 @@ std::vector<llama_adapter_lora_ptr> & common_init_result::lora() {
13091290 return pimpl->lora ;
13101291}
13111292
1312- common_init_result_ptr common_init_from_params (common_params & params) {
1313- common_init_result_ptr res (new common_init_result (params));
1293+ common_init_result_ptr common_init_from_params (common_params & params, bool model_only ) {
1294+ common_init_result_ptr res (new common_init_result (params, model_only ));
13141295
13151296 llama_model * model = res->model ();
13161297 if (model == NULL ) {
13171298 LOG_ERR (" %s: failed to load model '%s'\n " , __func__, params.model .path .c_str ());
13181299 return res;
13191300 }
13201301
1302+ if (model_only) {
1303+ return res;
1304+ }
1305+
13211306 llama_context * lctx = res->context ();
13221307 if (lctx == NULL ) {
13231308 LOG_ERR (" %s: failed to create context with model '%s'\n " , __func__, params.model .path .c_str ());
@@ -1381,7 +1366,7 @@ common_init_result_ptr common_init_from_params(common_params & params) {
13811366 }
13821367
13831368 if (params.warmup ) {
1384- LOG_WRN (" %s: warming up the model with an empty run - please wait ... (--no-warmup to disable)\n " , __func__);
1369+ LOG_INF (" %s: warming up the model with an empty run - please wait ... (--no-warmup to disable)\n " , __func__);
13851370
13861371 llama_set_warmup (lctx, true );
13871372
0 commit comments