diff options
Diffstat (limited to 'context.c')
| -rw-r--r-- | context.c | 7 |
1 files changed, 6 insertions, 1 deletions
| @@ -115,7 +115,10 @@ int main(int argc, char **argv) { | |||
| 115 | cfg = &models[0]; | 115 | cfg = &models[0]; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | struct llama_model *model = llama_model_load_from_file(cfg->filepath, llama_model_default_params()); | 118 | struct llama_model_params model_params = llama_model_default_params(); |
| 119 | model_params.n_gpu_layers = cfg->n_gpu_layers; | ||
| 120 | model_params.use_mmap = cfg->use_mmap; | ||
| 121 | struct llama_model *model = llama_model_load_from_file(cfg->filepath, model_params); | ||
| 119 | if (model == NULL) { | 122 | if (model == NULL) { |
| 120 | log_message(stderr, LOG_ERROR, "Unable to load embedding model"); | 123 | log_message(stderr, LOG_ERROR, "Unable to load embedding model"); |
| 121 | llama_backend_free(); | 124 | llama_backend_free(); |
| @@ -123,6 +126,8 @@ int main(int argc, char **argv) { | |||
| 123 | } | 126 | } |
| 124 | 127 | ||
| 125 | struct llama_context_params cparams = llama_context_default_params(); | 128 | struct llama_context_params cparams = llama_context_default_params(); |
| 129 | cparams.n_ctx = cfg->n_ctx; | ||
| 130 | cparams.n_batch = cfg->n_batch; | ||
| 126 | cparams.embeddings = true; | 131 | cparams.embeddings = true; |
| 127 | 132 | ||
| 128 | struct llama_context *embed_ctx = llama_init_from_model(model, cparams); | 133 | struct llama_context *embed_ctx = llama_init_from_model(model, cparams); |
