]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : fix build + fix fabs compile warnings (#8683)
authorGeorgi Gerganov <redacted>
Thu, 25 Jul 2024 16:57:31 +0000 (19:57 +0300)
committerGitHub <redacted>
Thu, 25 Jul 2024 16:57:31 +0000 (19:57 +0300)
ggml-ci

src/llama-grammar.h
src/llama.cpp

index 8e578e09f8c2dc53297bf259fac4bc4cb217e1ae..695ea0632bb84c698db84e833a615d32199821c1 100644 (file)
@@ -13,8 +13,6 @@ struct llama_grammar {
     llama_partial_utf8 partial_utf8;
 };
 
-struct llama_grammar * llama_get_grammar(struct llama_context * ctx);
-
 //
 // internal API
 //
index 972f870b072b8662a7b1aa73c323b343ab02ecde..bc0183741db4e44e280f0887fe0d548dc41d7edc 100644 (file)
@@ -2657,7 +2657,6 @@ struct llama_context {
     llama_context(const llama_model & model)
         : model(model)
         , sampling(llama_n_vocab(&model))
-        , grammar()
         , t_start_us(model.t_start_us)
         , t_load_us(model.t_load_us) {}
 
@@ -2675,7 +2674,6 @@ struct llama_context {
 
     struct llama_cparams        cparams;
     struct llama_sampling       sampling;
-    struct llama_grammar        grammar;
     struct llama_kv_cache       kv_self;
     struct llama_control_vector cvec;
 
@@ -14048,7 +14046,7 @@ static void llama_set_inputs(llama_context & lctx, const llama_batch & batch) {
                             f = -INFINITY;
                         } else {
                             if (hparams.use_alibi) {
-                                f = -fabs(lctx.kv_self.cells[i].pos - pos);
+                                f = -std::abs(lctx.kv_self.cells[i].pos - pos);
                             } else {
                                 f = 0.0f;
                             }
@@ -14102,7 +14100,7 @@ static void llama_set_inputs(llama_context & lctx, const llama_batch & batch) {
                         for (int s = 0; s < batch.n_seq_id[i]; ++s) {
                             if (batch.seq_id[i][s] == seq_id) {
                                 if (hparams.use_alibi) {
-                                    f = -fabs(batch.pos[i] - batch.pos[j]);
+                                    f = -std::abs(batch.pos[i] - batch.pos[j]);
                                 } else {
                                     f = 0.0f;
                                 }
@@ -16833,10 +16831,6 @@ const struct llama_vocab * llama_get_vocab(const struct llama_context * ctx) {
     return &ctx->model.vocab;
 }
 
-struct llama_grammar * llama_get_grammar(struct llama_context * ctx) {
-    return &ctx->grammar;
-}
-
 uint32_t llama_n_ctx(const struct llama_context * ctx) {
     return ctx->cparams.n_ctx;
 }