Skip to content

Commit 22c69a2

Browse files
committed
batched : add len CLI argument
1 parent 465219b commit 22c69a2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

examples/batched/batched.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ int main(int argc, char ** argv) {
1111
gpt_params params;
1212

1313
if (argc == 1 || argv[1][0] == '-') {
14-
printf("usage: %s MODEL_PATH [PROMPT] [PARALLEL]\n" , argv[0]);
14+
printf("usage: %s MODEL_PATH [PROMPT] [PARALLEL] [LEN]\n" , argv[0]);
1515
return 1 ;
1616
}
1717

18+
// number of parallel batches
1819
int n_parallel = 1;
1920

21+
// total length of the sequences including the prompt
22+
int n_len = 32;
23+
2024
if (argc >= 2) {
2125
params.model = argv[1];
2226
}
@@ -29,13 +33,14 @@ int main(int argc, char ** argv) {
2933
n_parallel = std::atoi(argv[3]);
3034
}
3135

36+
if (argc >= 5) {
37+
n_len = std::atoi(argv[4]);
38+
}
39+
3240
if (params.prompt.empty()) {
3341
params.prompt = "Hello my name is";
3442
}
3543

36-
// total length of the sequences including the prompt
37-
const int n_len = 32;
38-
3944
// init LLM
4045

4146
llama_backend_init(params.numa);

0 commit comments

Comments
 (0)