llama: update vendored code to commit 40c6d79f (#7875)

This commit is contained in:
Jeffrey Morgan 2024-12-10 19:21:34 -08:00 committed by GitHub
parent a37f4a86a7
commit 527cc97899
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
289 changed files with 58552 additions and 41806 deletions

33
llama/sampling_ext.h vendored
View file

@ -1,6 +1,6 @@
// TODO: this is a temporary wrapper to allow calling C++ code from CGo
#ifndef GPT_SAMPLER_EXT_H
#define GPT_SAMPLER_EXT_H
#ifndef SAMPLING_EXT_H
#define SAMPLING_EXT_H
#ifdef __cplusplus
extern "C"
@ -9,14 +9,11 @@ extern "C"
// Forward declaration to avoid include of "sampling.h" which has c++
// includes
struct gpt_sampler;
struct gpt_sampler_cparams
{
struct common_sampler;
struct common_sampler_cparams {
int32_t top_k;
float top_p;
float min_p;
float tfs_z;
float typical_p;
float temp;
int32_t penalty_last_n;
@ -31,21 +28,11 @@ extern "C"
char *grammar;
};
struct gpt_sampler *gpt_sampler_cinit(
const struct llama_model *model,
struct gpt_sampler_cparams *params);
void gpt_sampler_cfree(struct gpt_sampler *sampler);
void gpt_sampler_creset(struct gpt_sampler *sampler);
llama_token gpt_sampler_csample(
struct gpt_sampler *sampler,
struct llama_context *ctx_main,
int idx);
void gpt_sampler_caccept(
struct gpt_sampler *sampler,
llama_token id,
bool apply_grammar);
struct common_sampler *common_sampler_cinit(const struct llama_model *model, struct common_sampler_cparams *params);
void common_sampler_cfree(struct common_sampler *sampler);
void common_sampler_creset(struct common_sampler *sampler);
void common_sampler_caccept(struct common_sampler *sampler, llama_token id, bool apply_grammar);
llama_token common_sampler_csample(struct common_sampler *sampler, struct llama_context *ctx, int idx);
int schema_to_grammar(const char *json_schema, char *grammar, size_t max_len);
@ -53,4 +40,4 @@ extern "C"
}
#endif
#endif // GPT_SAMPLER_EXT_H
#endif // SAMPLING_EXT_H