| 1 | #include <cstdio> |
|---|---|
| 2 | #include <cstdlib> |
| 3 | #include <cstring> |
| 4 | |
| 5 | #include "get-model.h" |
| 6 | |
| 7 | char * get_model_or_exit(int argc, char *argv[]) { |
| 8 | char * model_path; |
| 9 | if (argc > 1) { |
| 10 | model_path = argv[1]; |
| 11 | |
| 12 | } else { |
| 13 | model_path = getenv(name: "LLAMACPP_TEST_MODELFILE"); |
| 14 | if (!model_path || strlen(s: model_path) == 0) { |
| 15 | fprintf(stderr, format: "\033[33mWARNING: No model file provided. Skipping this test. Set LLAMACPP_TEST_MODELFILE=<gguf_model_path> to silence this warning and run this test.\n\033[0m"); |
| 16 | exit(EXIT_SUCCESS); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | return model_path; |
| 21 | } |
| 22 |