fix build

This commit is contained in:
Xuan Son Nguyen 2024-09-09 19:02:40 +02:00
parent 6412a598a1
commit cf2a874142
3 changed files with 6 additions and 4 deletions

View file

@ -329,8 +329,8 @@ bool gpt_params_parse(int argc, char ** argv, llama_arg_context & ctx_arg) {
} }
if (ctx_arg.params.usage) { if (ctx_arg.params.usage) {
gpt_params_print_usage(ctx_arg); gpt_params_print_usage(ctx_arg);
if (ctx_arg.params.print_usage) { if (ctx_arg.print_usage) {
ctx_arg.params.print_usage(argc, argv); ctx_arg.print_usage(argc, argv);
} }
exit(0); exit(0);
} }

View file

@ -232,7 +232,6 @@ struct gpt_params {
bool kl_divergence = false; // compute KL divergence bool kl_divergence = false; // compute KL divergence
std::function<void(int, char **)> print_usage = nullptr; // print example-specific usage and example
bool usage = false; // print usage bool usage = false; // print usage
bool use_color = false; // use color to distinguish generations and inputs bool use_color = false; // use color to distinguish generations and inputs
bool special = false; // enable special token output bool special = false; // enable special token output

View file

@ -2,6 +2,9 @@
#include "common.h" #include "common.h"
#include <cmath>
#include <unordered_map>
// the ring buffer works similarly to std::deque, but with a fixed capacity // the ring buffer works similarly to std::deque, but with a fixed capacity
// TODO: deduplicate with llama-impl.h // TODO: deduplicate with llama-impl.h
template<typename T> template<typename T>
@ -420,7 +423,7 @@ std::vector<gpt_sampler_type> gpt_sampler_types_from_names(const std::vector<std
} }
std::vector<gpt_sampler_type> gpt_sampler_types_from_chars(const std::string & chars) { std::vector<gpt_sampler_type> gpt_sampler_types_from_chars(const std::string & chars) {
std::unordered_map<char, gpt_sampler_type> sampler_name_map { std::unordered_map<char, gpt_sampler_type> sampler_name_map = {
{ gpt_sampler_type_to_chr(GPT_SAMPLER_TYPE_TOP_K), GPT_SAMPLER_TYPE_TOP_K }, { gpt_sampler_type_to_chr(GPT_SAMPLER_TYPE_TOP_K), GPT_SAMPLER_TYPE_TOP_K },
{ gpt_sampler_type_to_chr(GPT_SAMPLER_TYPE_TFS_Z), GPT_SAMPLER_TYPE_TFS_Z }, { gpt_sampler_type_to_chr(GPT_SAMPLER_TYPE_TFS_Z), GPT_SAMPLER_TYPE_TFS_Z },
{ gpt_sampler_type_to_chr(GPT_SAMPLER_TYPE_TYPICAL_P), GPT_SAMPLER_TYPE_TYPICAL_P }, { gpt_sampler_type_to_chr(GPT_SAMPLER_TYPE_TYPICAL_P), GPT_SAMPLER_TYPE_TYPICAL_P },