@@ -47,15 +47,15 @@ struct omni_streaming_sample {
4747 :image_(image) {
4848 n_past_ = 0 ;
4949 dec_cnt_ = 0 ;
50- params.sparams .top_k = 1 ;
51- params.sparams .top_p = 1 .0f ;
52- ctx_sampling_ = common_sampler_init (model, params.sparams );
50+ params.sampling .top_k = 1 ;
51+ params.sampling .top_p = 1 .0f ;
52+ ctx_sampling_ = common_sampler_init (model, params.sampling );
5353 }
5454
5555 int32_t sample () {
5656 const llama_token id = common_sampler_sample (ctx_sampling_, ctx_omnivlm->ctx_llama , -1 );
5757 common_sampler_accept (ctx_sampling_, id, true );
58- if (llama_token_is_eog ( llama_get_model (ctx_omnivlm->ctx_llama ), id)) {
58+ if (llama_vocab_is_eog ( llama_model_get_vocab ( llama_get_model (ctx_omnivlm->ctx_llama ) ), id)) {
5959 ret_str_ = " </s>" ;
6060 } else {
6161 ret_str_ = common_token_to_piece (ctx_omnivlm->ctx_llama , id);
@@ -97,7 +97,7 @@ static struct llama_model * omnivlm_init(common_params * params) {
9797
9898 llama_model_params model_params = common_model_params_to_llama (*params);
9999
100- llama_model * model = llama_load_model_from_file (params->model .c_str (), model_params);
100+ llama_model * model = llama_model_load_from_file (params->model .c_str (), model_params);
101101 if (model == NULL ) {
102102 LOG_ERR (" %s: unable to load model\n " , __func__);
103103 return NULL ;
@@ -120,7 +120,7 @@ static struct omnivlm_context * omnivlm_init_context(common_params * params, lla
120120 llama_context_params ctx_params = common_context_params_to_llama (*params);
121121 ctx_params.n_ctx = params->n_ctx < 2048 ? 2048 : params->n_ctx ; // we need a longer context size to process image embeddings
122122
123- llama_context * ctx_llama = llama_new_context_with_model (model, ctx_params);
123+ llama_context * ctx_llama = llama_init_from_model (model, ctx_params);
124124
125125 if (ctx_llama == NULL ) {
126126 LOG_ERR (" %s: failed to create the llama_context\n " , __func__);
@@ -170,7 +170,7 @@ static const char * sample(struct common_sampler * smpl,
170170 const llama_token id = common_sampler_sample (smpl, ctx_llama, -1 );
171171 common_sampler_accept (smpl, id, true );
172172 static std::string ret;
173- if (llama_token_is_eog ( llama_get_model (ctx_llama), id)) {
173+ if (llama_vocab_is_eog ( llama_model_get_vocab ( llama_get_model (ctx_llama) ), id)) {
174174 ret = " </s>" ;
175175 } else {
176176 ret = common_token_to_piece (ctx_llama, id);
@@ -206,8 +206,8 @@ static const char* process_prompt(struct omnivlm_context * ctx_omnivlm, struct o
206206 }
207207 }
208208
209- params->sparams .top_k = 1 ;
210- params->sparams .top_p = 1 .0f ;
209+ params->sampling .top_k = 1 ;
210+ params->sampling .top_p = 1 .0f ;
211211
212212 eval_string (ctx_omnivlm->ctx_llama , system_prompt.c_str (), params->n_batch , &n_past, true );
213213 omnivlm_eval_image_embed (ctx_omnivlm->ctx_llama , image_embed, params->n_batch , &n_past);
@@ -217,7 +217,7 @@ static const char* process_prompt(struct omnivlm_context * ctx_omnivlm, struct o
217217
218218 LOG (" \n " );
219219
220- struct common_sampler * smpl = common_sampler_init (ctx_omnivlm->model , params->sparams );
220+ struct common_sampler * smpl = common_sampler_init (ctx_omnivlm->model , params->sampling );
221221 if (!smpl) {
222222 LOG_ERR (" %s: failed to initialize sampling subsystem\n " , __func__);
223223 exit (1 );
0 commit comments