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) {}
struct llama_cparams cparams;
struct llama_sampling sampling;
- struct llama_grammar grammar;
struct llama_kv_cache kv_self;
struct llama_control_vector cvec;
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;
}
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;
}
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;
}