mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-10-26 11:04:39 +00:00
Style
This commit is contained in:
@@ -16,30 +16,27 @@
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
void* load_gpt4all_model(const char *fname, int n_threads) {
|
||||
void* load_model(const char *fname, int n_threads) {
|
||||
// load the model
|
||||
llmodel_error new_error{};
|
||||
fprintf(stderr, "%s: fname '%s'\n",
|
||||
__func__, fname);
|
||||
auto gptj4all = llmodel_model_create2(fname, "auto", &new_error);
|
||||
if (gptj4all == NULL ){
|
||||
fprintf(stderr, "%s: error '%s'\n",
|
||||
__func__, new_error.message);
|
||||
|
||||
llmodel_error new_error{};
|
||||
auto model = llmodel_model_create2(fname, "auto", &new_error);
|
||||
if (model == nullptr ){
|
||||
fprintf(stderr, "%s: error '%s'\n",
|
||||
__func__, new_error.message);
|
||||
return nullptr;
|
||||
}
|
||||
llmodel_setThreadCount(gptj4all, n_threads);
|
||||
if (!llmodel_loadModel(gptj4all, fname)) {
|
||||
llmodel_setThreadCount(model, n_threads);
|
||||
if (!llmodel_loadModel(model, fname)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return gptj4all;
|
||||
return model;
|
||||
}
|
||||
|
||||
std::string res = "";
|
||||
void * mm;
|
||||
|
||||
void gpt4all_model_prompt( const char *prompt, void *m, char* result, int repeat_last_n, float repeat_penalty, int n_ctx, int tokens, int top_k,
|
||||
void model_prompt( const char *prompt, void *m, char* result, int repeat_last_n, float repeat_penalty, int n_ctx, int tokens, int top_k,
|
||||
float top_p, float temp, int n_batch,float ctx_erase)
|
||||
{
|
||||
llmodel_model* model = (llmodel_model*) m;
|
||||
@@ -101,7 +98,7 @@ void gpt4all_model_prompt( const char *prompt, void *m, char* result, int repeat
|
||||
free(prompt_context);
|
||||
}
|
||||
|
||||
void gpt4all_free_model(void *state_ptr) {
|
||||
void free_model(void *state_ptr) {
|
||||
llmodel_model* ctx = (llmodel_model*) state_ptr;
|
||||
llmodel_model_destroy(*ctx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user