@@ -2373,7 +2373,7 @@ int llama_apply_lora_from_file(struct llama_context * ctx, const char * path_lor
2373
2373
}
2374
2374
}
2375
2375
2376
- int llama_get_kv_cache_token_count (struct llama_context * ctx) {
2376
+ int llama_get_kv_cache_token_count (const struct llama_context * ctx) {
2377
2377
return ctx->model .kv_self .n ;
2378
2378
}
2379
2379
@@ -2387,7 +2387,7 @@ void llama_set_rng_seed(struct llama_context * ctx, int seed) {
2387
2387
}
2388
2388
2389
2389
// Returns the size of the state
2390
- size_t llama_get_state_size (struct llama_context * ctx) {
2390
+ size_t llama_get_state_size (const struct llama_context * ctx) {
2391
2391
// we don't know size of rng until we actually serialize it. so reserve more than enough memory for its serialized state.
2392
2392
// for reference, std::mt19937(1337) serializes to 6701 bytes.
2393
2393
const size_t s_rng_size = sizeof (size_t );
@@ -2605,15 +2605,15 @@ int llama_tokenize(
2605
2605
return res.size ();
2606
2606
}
2607
2607
2608
- int llama_n_vocab (struct llama_context * ctx) {
2608
+ int llama_n_vocab (const struct llama_context * ctx) {
2609
2609
return ctx->vocab .id_to_token .size ();
2610
2610
}
2611
2611
2612
- int llama_n_ctx (struct llama_context * ctx) {
2612
+ int llama_n_ctx (const struct llama_context * ctx) {
2613
2613
return ctx->model .hparams .n_ctx ;
2614
2614
}
2615
2615
2616
- int llama_n_embd (struct llama_context * ctx) {
2616
+ int llama_n_embd (const struct llama_context * ctx) {
2617
2617
return ctx->model .hparams .n_embd ;
2618
2618
}
2619
2619
@@ -2625,7 +2625,7 @@ float * llama_get_embeddings(struct llama_context * ctx) {
2625
2625
return ctx->embedding .data ();
2626
2626
}
2627
2627
2628
- const char * llama_token_to_str (struct llama_context * ctx, llama_token token) {
2628
+ const char * llama_token_to_str (const struct llama_context * ctx, llama_token token) {
2629
2629
if (token >= llama_n_vocab (ctx)) {
2630
2630
return nullptr ;
2631
2631
}
0 commit comments