12 File tempLogFile = File::createTempFile(
".log");
13 auto createLogResult = tempLogFile.create();
15 if (createLogResult.wasOk())
23 params.
model = path.getFullPathName().toRawUTF8();
31 if (createLogResult.wasOk())
34 tempLogFile.deleteFile();
54 return std::vector<float>();
61 tokens.resize(n_tokens);
65 const int n_threads = 6;
67 const int n_threads = 1;
69 bert_eval(
bctx, n_threads, tokens.data(), n_tokens, embeddings.data());
80 if (ggmlDataFile.exists() ==
true)
94 stdoutFd = dup(fileno(stdout));
95 if (freopen(filePath.c_str(),
"w", stdout) == NULL)
98 std::cout <<
"Failed to redirect standard output to " << filePath << std::endl;
107 dup2(stdoutFd, fileno(stdout));
113 std::cout <<
"Failed to restore redirected printf" << std::endl;
struct bert_ctx * bert_load_from_file(const char *fname)
void bert_tokenize(struct bert_ctx *ctx, const char *text, bert_vocab_id *tokens, int32_t *n_tokens, int32_t n_max_tokens)
int32_t bert_n_embd(bert_ctx *ctx)
void bert_eval(struct bert_ctx *ctx, int32_t n_threads, bert_vocab_id *tokens, int32_t n_tokens, float *embeddings)
void bert_free(bert_ctx *ctx)
static String convertFilePathToOSX(const String &path)
Definition AssetManager.cpp:596
static File getPluginDirectory()
Definition AssetManager.cpp:392
String StringsIntoPath(Args... args)
Joins multiple string arguments into a path string.
Definition helpers.h:25
Definition AirAbsorptionFilter.cpp:2
constexpr char modelFileName[]
Definition SentenceTransformer.h:7
const char * model
Definition bert.h:16