Skip to content

Commit 28cac49

Browse files
author
Olivier Chafik
committed
drop llama_sampler_accept_str
1 parent e211629 commit 28cac49

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

include/llama.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,6 @@ extern "C" {
11041104
struct llama_sampler_i {
11051105
const char * (*name) (const struct llama_sampler * smpl); // can be NULL
11061106
void (*accept)( struct llama_sampler * smpl, llama_token token); // can be NULL
1107-
void (*accept_str)( struct llama_sampler * smpl, const char * text); // can be NULL
11081107
void (*apply) ( struct llama_sampler * smpl, llama_token_data_array * cur_p); // required
11091108
void (*reset) ( struct llama_sampler * smpl); // can be NULL
11101109
struct llama_sampler * (*clone) (const struct llama_sampler * smpl); // can be NULL if ctx is NULL
@@ -1122,7 +1121,6 @@ extern "C" {
11221121
// mirror of llama_sampler_i:
11231122
LLAMA_API const char * llama_sampler_name (const struct llama_sampler * smpl);
11241123
LLAMA_API void llama_sampler_accept( struct llama_sampler * smpl, llama_token token);
1125-
LLAMA_API void llama_sampler_accept_str( struct llama_sampler * smpl, const char * piece);
11261124
LLAMA_API void llama_sampler_apply ( struct llama_sampler * smpl, llama_token_data_array * cur_p);
11271125
LLAMA_API void llama_sampler_reset ( struct llama_sampler * smpl);
11281126
LLAMA_API struct llama_sampler * llama_sampler_clone (const struct llama_sampler * smpl);

src/llama-sampling.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,6 @@ void llama_sampler_accept(struct llama_sampler * smpl, llama_token token) {
330330
}
331331
}
332332

333-
void llama_sampler_accept_str(struct llama_sampler * smpl, const char * piece) {
334-
if (smpl->iface->accept_str) {
335-
smpl->iface->accept_str(smpl, piece);
336-
}
337-
}
338-
339333
void llama_sampler_apply(struct llama_sampler * smpl, struct llama_token_data_array * cur_p) {
340334
GGML_ASSERT(smpl->iface->apply);
341335
smpl->iface->apply(smpl, cur_p);
@@ -471,7 +465,6 @@ static void llama_sampler_chain_free(struct llama_sampler * smpl) {
471465
static struct llama_sampler_i llama_sampler_chain_i = {
472466
/* .name = */ llama_sampler_chain_name,
473467
/* .accept = */ llama_sampler_chain_accept,
474-
/* .accept_str = */ nullptr,
475468
/* .apply = */ llama_sampler_chain_apply,
476469
/* .reset = */ llama_sampler_chain_reset,
477470
/* .clone = */ llama_sampler_chain_clone,
@@ -546,7 +539,6 @@ static void llama_sampler_greedy_apply(struct llama_sampler * /*smpl*/, llama_to
546539
static struct llama_sampler_i llama_sampler_greedy_i = {
547540
/* .name = */ llama_sampler_greedy_name,
548541
/* .accept = */ nullptr,
549-
/* .accept_str = */ nullptr,
550542
/* .apply = */ llama_sampler_greedy_apply,
551543
/* .reset = */ nullptr,
552544
/* .clone = */ nullptr,
@@ -608,7 +600,6 @@ static void llama_sampler_dist_free(struct llama_sampler * smpl) {
608600
static struct llama_sampler_i llama_sampler_dist_i = {
609601
/* .name = */ llama_sampler_dist_name,
610602
/* .accept = */ nullptr,
611-
/* .accept_str = */ nullptr,
612603
/* .apply = */ llama_sampler_dist_apply,
613604
/* .reset = */ llama_sampler_dist_reset,
614605
/* .clone = */ llama_sampler_dist_clone,
@@ -640,7 +631,6 @@ static void llama_sampler_softmax_apply(struct llama_sampler * /*smpl*/, llama_t
640631
static struct llama_sampler_i llama_sampler_softmax_i = {
641632
/* .name = */ llama_sampler_softmax_name,
642633
/* .accept = */ nullptr,
643-
/* .accept_str = */ nullptr,
644634
/* .apply = */ llama_sampler_softmax_apply,
645635
/* .reset = */ nullptr,
646636
/* .clone = */ nullptr,
@@ -681,7 +671,6 @@ static void llama_sampler_top_k_free(struct llama_sampler * smpl) {
681671
static struct llama_sampler_i llama_sampler_top_k_i = {
682672
/* .name = */ llama_sampler_top_k_name,
683673
/* .accept = */ nullptr,
684-
/* .accept_str = */ nullptr,
685674
/* .apply = */ llama_sampler_top_k_apply,
686675
/* .reset = */ nullptr,
687676
/* .clone = */ llama_sampler_top_k_clone,
@@ -748,7 +737,6 @@ static void llama_sampler_top_p_free(struct llama_sampler * smpl) {
748737
static struct llama_sampler_i llama_sampler_top_p_i = {
749738
/* .name = */ llama_sampler_top_p_name,
750739
/* .accept = */ nullptr,
751-
/* .accept_str = */ nullptr,
752740
/* .apply = */ llama_sampler_top_p_apply,
753741
/* .reset = */ nullptr,
754742
/* .clone = */ llama_sampler_top_p_clone,
@@ -845,7 +833,6 @@ static void llama_sampler_min_p_free(struct llama_sampler * smpl) {
845833
static struct llama_sampler_i llama_sampler_min_p_i = {
846834
/* .name = */ llama_sampler_min_p_name,
847835
/* .accept = */ nullptr,
848-
/* .accept_str = */ nullptr,
849836
/* .apply = */ llama_sampler_min_p_apply,
850837
/* .reset = */ nullptr,
851838
/* .clone = */ llama_sampler_min_p_clone,
@@ -945,7 +932,6 @@ static void llama_sampler_typical_free(struct llama_sampler * smpl) {
945932
static struct llama_sampler_i llama_sampler_typical_i = {
946933
/* .name = */ llama_sampler_typical_name,
947934
/* .accept = */ nullptr,
948-
/* .accept_str = */ nullptr,
949935
/* .apply = */ llama_sampler_typical_apply,
950936
/* .reset = */ nullptr,
951937
/* .clone = */ llama_sampler_typical_clone,
@@ -990,7 +976,6 @@ static void llama_sampler_temp_free(struct llama_sampler * smpl) {
990976
static struct llama_sampler_i llama_sampler_temp_i = {
991977
/* .name = */ llama_sampler_temp_name,
992978
/* .accept = */ nullptr,
993-
/* .accept_str = */ nullptr,
994979
/* .apply = */ llama_sampler_temp_apply,
995980
/* .reset = */ nullptr,
996981
/* .clone = */ llama_sampler_temp_clone,
@@ -1101,7 +1086,6 @@ static void llama_sampler_temp_ext_free(struct llama_sampler * smpl) {
11011086
static struct llama_sampler_i llama_sampler_temp_ext_i = {
11021087
/* .name = */ llama_sampler_temp_ext_name,
11031088
/* .accept = */ nullptr,
1104-
/* .accept_str = */ nullptr,
11051089
/* .apply = */ llama_sampler_temp_ext_apply,
11061090
/* .reset = */ nullptr,
11071091
/* .clone = */ llama_sampler_temp_ext_clone,
@@ -1193,7 +1177,6 @@ static void llama_sampler_xtc_reset(struct llama_sampler * smpl) {
11931177
static struct llama_sampler_i llama_sampler_xtc_i = {
11941178
/* .name = */ llama_sampler_xtc_name,
11951179
/* .accept = */ nullptr,
1196-
/* .accept_str = */ nullptr,
11971180
/* .apply = */ llama_sample_xtc_apply,
11981181
/* .reset = */ llama_sampler_xtc_reset,
11991182
/* .clone = */ llama_sampler_xtc_clone,
@@ -1301,7 +1284,6 @@ static void llama_sampler_mirostat_free(struct llama_sampler * smpl) {
13011284
static struct llama_sampler_i llama_sampler_mirostat_i = {
13021285
/* .name = */ llama_sampler_mirostat_name,
13031286
/* .accept = */ nullptr,
1304-
/* .accept_str = */ nullptr,
13051287
/* .apply = */ llama_sampler_mirostat_apply,
13061288
/* .reset = */ llama_sampler_mirostat_reset,
13071289
/* .clone = */ llama_sampler_mirostat_clone,
@@ -1401,7 +1383,6 @@ static void llama_sampler_mirostat_v2_free(struct llama_sampler * smpl) {
14011383
static struct llama_sampler_i llama_sampler_mirostat_v2_i = {
14021384
/* .name = */ llama_sampler_mirostat_v2_name,
14031385
/* .accept = */ nullptr,
1404-
/* .accept_str = */ nullptr,
14051386
/* .apply = */ llama_sampler_mirostat_v2_apply,
14061387
/* .reset = */ llama_sampler_mirostat_v2_reset,
14071388
/* .clone = */ llama_sampler_mirostat_v2_clone,
@@ -1445,13 +1426,6 @@ static void llama_sampler_grammar_accept_impl(struct llama_sampler * smpl, llama
14451426
}
14461427
}
14471428

1448-
static void llama_sampler_grammar_accept_str(struct llama_sampler * smpl, const char * piece) {
1449-
auto * ctx = (llama_sampler_grammar *) smpl->ctx;
1450-
if (ctx->grammar) {
1451-
llama_grammar_accept_str(*ctx->grammar, piece);
1452-
}
1453-
}
1454-
14551429
static void llama_sampler_grammar_apply(struct llama_sampler * smpl, llama_token_data_array * cur_p) {
14561430
auto * ctx = (llama_sampler_grammar *) smpl->ctx;
14571431
if (ctx->grammar) {
@@ -1515,7 +1489,6 @@ static void llama_sampler_grammar_free(struct llama_sampler * smpl) {
15151489
static struct llama_sampler_i llama_sampler_grammar_i = {
15161490
/* .name = */ llama_sampler_grammar_name,
15171491
/* .accept = */ llama_sampler_grammar_accept_impl,
1518-
/* .accept_str = */ llama_sampler_grammar_accept_str,
15191492
/* .apply = */ llama_sampler_grammar_apply,
15201493
/* .reset = */ llama_sampler_grammar_reset,
15211494
/* .clone = */ llama_sampler_grammar_clone,
@@ -1669,7 +1642,6 @@ static void llama_sampler_penalties_free(struct llama_sampler * smpl) {
16691642
static struct llama_sampler_i llama_sampler_penalties_i = {
16701643
/* .name = */ llama_sampler_penalties_name,
16711644
/* .accept = */ llama_sampler_penalties_accept,
1672-
/* .accept_str = */ nullptr,
16731645
/* .apply = */ llama_sampler_penalties_apply,
16741646
/* .reset = */ llama_sampler_penalties_reset,
16751647
/* .clone = */ llama_sampler_penalties_clone,
@@ -2009,7 +1981,6 @@ static void llama_sampler_dry_free(struct llama_sampler * smpl) {
20091981
static struct llama_sampler_i llama_sampler_dry_i = {
20101982
/* .name = */ llama_sampler_dry_name,
20111983
/* .accept = */ llama_sampler_dry_accept,
2012-
/* .accept_str = */ nullptr,
20131984
/* .apply = */ llama_sampler_dry_apply,
20141985
/* .reset = */ llama_sampler_dry_reset,
20151986
/* .clone = */ llama_sampler_dry_clone,
@@ -2151,7 +2122,6 @@ static void llama_sampler_logit_bias_free(struct llama_sampler * smpl) {
21512122
static struct llama_sampler_i llama_sampler_logit_bias_i = {
21522123
/* .name = */ llama_sampler_logit_bias_name,
21532124
/* .accept = */ nullptr,
2154-
/* .accept_str = */ nullptr,
21552125
/* .apply = */ llama_sampler_logit_bias_apply,
21562126
/* .reset = */ nullptr,
21572127
/* .clone = */ llama_sampler_logit_bias_clone,
@@ -2377,7 +2347,6 @@ static void llama_sampler_infill_free(struct llama_sampler * smpl) {
23772347
static struct llama_sampler_i llama_sampler_infill_i = {
23782348
/* .name = */ llama_sampler_infill_name,
23792349
/* .accept = */ nullptr,
2380-
/* .accept_str = */ nullptr,
23812350
/* .apply = */ llama_sampler_infill_apply,
23822351
/* .reset = */ nullptr,
23832352
/* .clone = */ llama_sampler_infill_clone,

0 commit comments

Comments
 (0)