Skip to content

Commit 422b2e8

Browse files
committed
ggml : sync latest repo (mostly refactoring changes)
1 parent a461ac4 commit 422b2e8

File tree

11 files changed

+2144
-1667
lines changed

11 files changed

+2144
-1667
lines changed

examples/common.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) {
3939
params.top_p = std::stof(argv[++i]);
4040
} else if (arg == "--temp") {
4141
params.temp = std::stof(argv[++i]);
42+
} else if (arg == "--repeat-last-n") {
43+
params.repeat_last_n = std::stof(argv[++i]);
44+
} else if (arg == "--repeat-penalty") {
45+
params.repeat_penalty = std::stof(argv[++i]);
4246
} else if (arg == "-b" || arg == "--batch_size") {
4347
params.n_batch = std::stoi(argv[++i]);
4448
} else if (arg == "-m" || arg == "--model") {
@@ -90,6 +94,8 @@ void gpt_print_usage(int /*argc*/, char ** argv, const gpt_params & params) {
9094
fprintf(stderr, " --top_k N top-k sampling (default: %d)\n", params.top_k);
9195
fprintf(stderr, " --top_p N top-p sampling (default: %.1f)\n", params.top_p);
9296
fprintf(stderr, " --temp N temperature (default: %.1f)\n", params.temp);
97+
fprintf(stderr, " --repeat-last-n N last n tokens to consider for penalize (default: %d, 0 = disabled)\n", params.repeat_last_n);
98+
fprintf(stderr, " --repeat-penalty N penalize repeat sequence of tokens (default: %.2f, 1.0 = disabled)\n", (double)params.repeat_penalty);
9399
fprintf(stderr, " -b N, --batch_size N batch size for prompt processing (default: %d)\n", params.n_batch);
94100
fprintf(stderr, " -m FNAME, --model FNAME\n");
95101
fprintf(stderr, " model path (default: %s)\n", params.model.c_str());

examples/common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ struct gpt_params {
2323
int32_t top_k = 40;
2424
float top_p = 0.9f;
2525
float temp = 0.9f;
26+
int32_t repeat_last_n = 64;
27+
float repeat_penalty = 1.00f;
2628

2729
int32_t n_batch = 8; // batch size for prompt processing
2830

examples/quantize/quantize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ bool whisper_model_quantize(const std::string & fname_inp, const std::string & f
5757
{
5858
uint32_t magic;
5959
finp.read((char *) &magic, sizeof(magic));
60-
if (magic != 0x67676d6c) {
60+
if (magic != GGML_FILE_MAGIC) {
6161
fprintf(stderr, "%s: invalid model file '%s' (bad magic)\n", __func__, fname_inp.c_str());
6262
return false;
6363
}

0 commit comments

Comments
 (0)