Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 58227ff

Browse filesBrowse files
authored
perplexity : require positive --ctx-size arg (ggml-org#6695)
1 parent 4fbd809 commit 58227ff
Copy full SHA for 58227ff

File tree

Expand file treeCollapse file tree

1 file changed

+11
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-3
lines changed

‎examples/perplexity/perplexity.cpp

Copy file name to clipboardExpand all lines: examples/perplexity/perplexity.cpp
+11-3Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,12 +1852,20 @@ int main(int argc, char ** argv) {
18521852

18531853
const int32_t n_ctx = params.n_ctx;
18541854

1855+
if (n_ctx <= 0) {
1856+
fprintf(stderr, "%s: perplexity tool requires '--ctx-size' > 0\n", __func__);
1857+
return 1;
1858+
}
1859+
18551860
const bool ppl = !params.hellaswag && !params.winogrande && !params.multiple_choice && !params.kl_divergence;
1861+
18561862
if (ppl) {
1857-
int n_seq = std::max(1, params.n_batch / n_ctx);
1858-
int32_t n_kv = n_seq * n_ctx;
1863+
const int32_t n_seq = std::max(1, params.n_batch / n_ctx);
1864+
const int32_t n_kv = n_seq * n_ctx;
1865+
18591866
params.n_parallel = n_seq;
1860-
params.n_ctx = n_kv;
1867+
params.n_ctx = n_kv;
1868+
18611869
params.n_batch = std::min(params.n_batch, n_kv);
18621870
} else {
18631871
params.n_batch = std::min(params.n_batch, params.n_ctx);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.