sampling : add llama_sampling_print helper

This commit is contained in:
Georgi Gerganov 2023-10-20 18:02:50 +03:00
parent b526561583
commit 7e2b5fb1dd
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
4 changed files with 21 additions and 6 deletions

View file

@ -30,8 +30,8 @@ typedef struct llama_sampling_params {
// Classifier-Free Guidance
// https://arxiv.org/abs/2306.17806
std::string cfg_negative_prompt; // string to help guidance
float cfg_scale = 1.f; // How strong is guidance
std::string cfg_negative_prompt; // string to help guidance
float cfg_scale = 1.f; // how strong is guidance
std::unordered_map<llama_token, float> logit_bias; // logit bias for specific tokens
} llama_sampling_params;
@ -70,6 +70,9 @@ void llama_sampling_reset(llama_sampling_context * ctx);
// Copy the sampler context
void llama_sampling_cp(llama_sampling_context * src, llama_sampling_context * dst);
// Print sampling parameters into a string
std::string llama_sampling_print(const llama_sampling_params & params);
// this is a common sampling function used across the examples for convenience
// it can serve as a starting point for implementing your own sampling function
// Note: When using multiple sequences, it is the caller's responsibility to call