Skip to content

Commit 54a1c6f

Browse files
authored
fix: rename a param to match llama.cpp (#8)
1 parent 2e92f2e commit 54a1c6f

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

llama/addon.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class LLAMAModel : public Napi::ObjectWrap<LLAMAModel> {
3434
params.n_batch = options.Get("batchSize").As<Napi::Number>().Int32Value();
3535
}
3636

37-
if (options.Has("gpuCores")) {
38-
params.n_gpu_layers = options.Get("gpuCores").As<Napi::Number>().Int32Value();
37+
if (options.Has("gpuLayers")) {
38+
params.n_gpu_layers = options.Get("gpuLayers").As<Napi::Number>().Int32Value();
3939
}
4040

4141
if (options.Has("lowVram")) {

src/llamaEvaluator/LlamaModel.ts

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class LlamaModel {
1313
* @param {number | null} [options.seed] - If null, a random seed will be used
1414
* @param {number} [options.contextSize] - text context size
1515
* @param {number} [options.batchSize] - prompt processing batch size
16-
* @param {number} [options.gpuCores] - number of layers to store in VRAM
16+
* @param {number} [options.gpuLayers] - number of layers to store in VRAM
1717
* @param {boolean} [options.lowVram] - if true, reduce VRAM usage at the cost of performance
1818
* @param {boolean} [options.f16Kv] - use fp16 for KV cache
1919
* @param {boolean} [options.logitsAll] - the llama_eval() call computes all logits, not just the last one
@@ -23,18 +23,50 @@ export class LlamaModel {
2323
* @param {boolean} [options.embedding] - embedding mode only
2424
*/
2525
public constructor({
26-
modelPath, seed = null, contextSize = 1024 * 4, batchSize, gpuCores,
26+
modelPath, seed = null, contextSize = 1024 * 4, batchSize, gpuLayers,
2727
lowVram, f16Kv, logitsAll, vocabOnly, useMmap, useMlock, embedding
2828
}: {
29-
modelPath: string, seed?: number | null, contextSize?: number, batchSize?: number, gpuCores?: number,
30-
lowVram?: boolean, f16Kv?: boolean, logitsAll?: boolean, vocabOnly?: boolean, useMmap?: boolean, useMlock?: boolean,
29+
/** path to the model on the filesystem */
30+
modelPath: string,
31+
32+
/** If null, a random seed will be used */
33+
seed?: number | null,
34+
35+
/** text context size */
36+
contextSize?: number,
37+
38+
/** prompt processing batch size */
39+
batchSize?: number,
40+
41+
/** number of layers to store in VRAM */
42+
gpuLayers?: number,
43+
44+
/** if true, reduce VRAM usage at the cost of performance */
45+
lowVram?: boolean,
46+
47+
/** use fp16 for KV cache */
48+
f16Kv?: boolean,
49+
50+
/** the llama_eval() call computes all logits, not just the last one */
51+
logitsAll?: boolean,
52+
53+
/** only load the vocabulary, no weights */
54+
vocabOnly?: boolean,
55+
56+
/** use mmap if possible */
57+
useMmap?: boolean,
58+
59+
/** force system to keep model in RAM */
60+
useMlock?: boolean,
61+
62+
/** embedding mode only */
3163
embedding?: boolean
3264
}) {
3365
this._model = new LLAMAModel(modelPath, removeNullFields({
3466
seed: seed != null ? Math.max(-1, seed) : undefined,
3567
contextSize,
3668
batchSize,
37-
gpuCores,
69+
gpuLayers,
3870
lowVram,
3971
f16Kv,
4072
logitsAll,

0 commit comments

Comments
 (0)