merge upstream and fix conflicts

This commit is contained in:
likelovewant
2024-12-12 13:17:55 +08:00
parent a0caaa2bc8
commit a64347c6d4
383 changed files with 59815 additions and 43978 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