]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
batched : add len CLI argument
authorGeorgi Gerganov <redacted>
Sun, 22 Oct 2023 05:37:20 +0000 (08:37 +0300)
committerGeorgi Gerganov <redacted>
Sun, 22 Oct 2023 05:37:20 +0000 (08:37 +0300)
examples/batched/batched.cpp

index 155212165882c8d347f55851268265755819ad79..2797329b4fc57f49f1da294e2297a51474ab8afb 100644 (file)
@@ -11,12 +11,16 @@ int main(int argc, char ** argv) {
     gpt_params params;
 
     if (argc == 1 || argv[1][0] == '-') {
-        printf("usage: %s MODEL_PATH [PROMPT] [PARALLEL]\n" , argv[0]);
+        printf("usage: %s MODEL_PATH [PROMPT] [PARALLEL] [LEN]\n" , argv[0]);
         return 1 ;
     }
 
+    // number of parallel batches
     int n_parallel = 1;
 
+    // total length of the sequences including the prompt
+    int n_len = 32;
+
     if (argc >= 2) {
         params.model = argv[1];
     }
@@ -29,13 +33,14 @@ int main(int argc, char ** argv) {
         n_parallel = std::atoi(argv[3]);
     }
 
+    if (argc >= 5) {
+        n_len = std::atoi(argv[4]);
+    }
+
     if (params.prompt.empty()) {
         params.prompt = "Hello my name is";
     }
 
-    // total length of the sequences including the prompt
-    const int n_len = 32;
-
     // init LLM
 
     llama_backend_init(params.numa);