mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-25 02:44:36 +00:00
perplexity : require positive --ctx-size arg (#6695)
This commit is contained in:
parent
4fbd8098e6
commit
58227ffdeb
@ -1852,12 +1852,20 @@ int main(int argc, char ** argv) {
|
|||||||
|
|
||||||
const int32_t n_ctx = params.n_ctx;
|
const int32_t n_ctx = params.n_ctx;
|
||||||
|
|
||||||
|
if (n_ctx <= 0) {
|
||||||
|
fprintf(stderr, "%s: perplexity tool requires '--ctx-size' > 0\n", __func__);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
const bool ppl = !params.hellaswag && !params.winogrande && !params.multiple_choice && !params.kl_divergence;
|
const bool ppl = !params.hellaswag && !params.winogrande && !params.multiple_choice && !params.kl_divergence;
|
||||||
|
|
||||||
if (ppl) {
|
if (ppl) {
|
||||||
int n_seq = std::max(1, params.n_batch / n_ctx);
|
const int32_t n_seq = std::max(1, params.n_batch / n_ctx);
|
||||||
int32_t n_kv = n_seq * n_ctx;
|
const int32_t n_kv = n_seq * n_ctx;
|
||||||
|
|
||||||
params.n_parallel = n_seq;
|
params.n_parallel = n_seq;
|
||||||
params.n_ctx = n_kv;
|
params.n_ctx = n_kv;
|
||||||
|
|
||||||
params.n_batch = std::min(params.n_batch, n_kv);
|
params.n_batch = std::min(params.n_batch, n_kv);
|
||||||
} else {
|
} else {
|
||||||
params.n_batch = std::min(params.n_batch, params.n_ctx);
|
params.n_batch = std::min(params.n_batch, params.n_ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user