Skip to content

Commit 44d3675

Browse files
adminadmin
authored andcommitted
Modified Linux part for M4
1 parent 3d8072e commit 44d3675

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

examples/xbapp/slminfer.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,16 @@ std::string pfx_file_path(std::string pfx) {
7979
#else
8080

8181
static std::hash<std::string> hasher;
82-
static std::__fs::filesystem::path dir = "./llama_cache";
82+
static const char* dir = "./llama_cache";
8383

8484
// create the cache dir if it does not exist yet
85-
std::__fs::filesystem::create_directory(dir);
85+
struct stat info;
86+
if (stat(dir, &info) != 0) {
87+
mkdir(dir, 0777);
88+
}
8689

8790
// default generated file name
88-
std::string pfx_path(dir.c_str());
91+
std::string pfx_path(dir);
8992
std::string full_file_path = pfx_path + "/" + std::to_string(hasher(pfx));
9093

9194
#endif // _WIN32
@@ -325,7 +328,7 @@ int slm_inference(xbapp_params& xbparams) {
325328
}
326329

327330
int64_t t_start_generation = ggml_time_us();
328-
printf("Prompt TTFT = %.2fms (size = %lld)\n",
331+
printf("Prompt TTFT = %.2fms (size = %zu)\n",
329332
((t_start_generation - t_start_decoding) / 1000.0f),
330333
embd.size());
331334

examples/xbapp/xbapp.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <filesystem>
1919

2020
#ifdef _WIN32
21+
2122
#if !defined WIN32_LEAN_AND_MEAN
2223
#define WIN32_LEAN_AND_MEAN
2324
#endif // WIN32_LEAN_AND_MEAN
@@ -30,6 +31,12 @@
3031
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
3132
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
3233
#endif
34+
35+
#else
36+
37+
#include <sys/stat.h>
38+
#include <sys/types.h>
39+
3340
#endif // WIN32
3441

3542
struct xbapp_params {

0 commit comments

Comments
 (0)