1
0

get-model.cpp 594 B

123456789101112131415161718192021
  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <cstring>
  4. #include "get-model.h"
  5. char * get_model_or_exit(int argc, char *argv[]) {
  6. char * model_path;
  7. if (argc > 1) {
  8. model_path = argv[1];
  9. } else {
  10. model_path = getenv("LLAMACPP_TEST_MODELFILE");
  11. if (!model_path || strlen(model_path) == 0) {
  12. fprintf(stderr, "\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");
  13. exit(EXIT_SUCCESS);
  14. }
  15. }
  16. return model_path;
  17. }