node-llama-cpp 3.0.0-beta.17 → 3.0.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/dist/ChatWrapper.js +3 -3
- package/dist/ChatWrapper.js.map +1 -1
- package/dist/apiDocsOverrides.d.ts +1 -0
- package/dist/apiDocsOverrides.js +5 -0
- package/dist/apiDocsOverrides.js.map +1 -0
- package/dist/bindings/AddonTypes.d.ts +1 -0
- package/dist/bindings/getLlama.d.ts +5 -1
- package/dist/bindings/getLlama.js +11 -4
- package/dist/bindings/getLlama.js.map +1 -1
- package/dist/bindings/utils/hasBuildingFromSourceDependenciesInstalled.d.ts +3 -0
- package/dist/bindings/utils/hasBuildingFromSourceDependenciesInstalled.js +27 -0
- package/dist/bindings/utils/hasBuildingFromSourceDependenciesInstalled.js.map +1 -0
- package/dist/chatWrappers/generic/TemplateChatWrapper.d.ts +1 -2
- package/dist/chatWrappers/generic/TemplateChatWrapper.js +1 -2
- package/dist/chatWrappers/generic/TemplateChatWrapper.js.map +1 -1
- package/dist/chatWrappers/utils/isJinjaTemplateEquivalentToSpecializedChatWrapper.js +2 -2
- package/dist/chatWrappers/utils/isJinjaTemplateEquivalentToSpecializedChatWrapper.js.map +1 -1
- package/dist/cli/cli.js +5 -3
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/commands/DebugCommand.js +3 -5
- package/dist/cli/commands/DebugCommand.js.map +1 -1
- package/dist/cli/commands/DownloadCommand.d.ts +1 -1
- package/dist/cli/commands/DownloadCommand.js +2 -1
- package/dist/cli/commands/DownloadCommand.js.map +1 -1
- package/dist/cli/commands/PullCommand.d.ts +12 -0
- package/dist/cli/commands/PullCommand.js +109 -0
- package/dist/cli/commands/PullCommand.js.map +1 -0
- package/dist/cli/commands/inspect/commands/InspectGgufCommand.d.ts +1 -0
- package/dist/cli/commands/inspect/commands/InspectGgufCommand.js +23 -11
- package/dist/cli/commands/inspect/commands/InspectGgufCommand.js.map +1 -1
- package/dist/cli/commands/inspect/commands/InspectMeasureCommand.js +2 -1
- package/dist/cli/commands/inspect/commands/InspectMeasureCommand.js.map +1 -1
- package/dist/cli/recommendedModels.js +12 -20
- package/dist/cli/recommendedModels.js.map +1 -1
- package/dist/cli/utils/resolveCommandGgufPath.d.ts +3 -1
- package/dist/cli/utils/resolveCommandGgufPath.js +41 -97
- package/dist/cli/utils/resolveCommandGgufPath.js.map +1 -1
- package/dist/cli/utils/resolveModelRecommendationFileOptions.d.ts +2 -2
- package/dist/cli/utils/resolveModelRecommendationFileOptions.js +1 -4
- package/dist/cli/utils/resolveModelRecommendationFileOptions.js.map +1 -1
- package/dist/evaluator/LlamaChat/LlamaChat.d.ts +18 -2
- package/dist/evaluator/LlamaChat/LlamaChat.js +255 -205
- package/dist/evaluator/LlamaChat/LlamaChat.js.map +1 -1
- package/dist/evaluator/LlamaChatSession/LlamaChatSession.d.ts +22 -3
- package/dist/evaluator/LlamaChatSession/LlamaChatSession.js +18 -7
- package/dist/evaluator/LlamaChatSession/LlamaChatSession.js.map +1 -1
- package/dist/evaluator/LlamaCompletion.js +1 -1
- package/dist/evaluator/LlamaCompletion.js.map +1 -1
- package/dist/evaluator/LlamaContext/LlamaContext.d.ts +2 -7
- package/dist/evaluator/LlamaContext/LlamaContext.js +12 -12
- package/dist/evaluator/LlamaContext/LlamaContext.js.map +1 -1
- package/dist/evaluator/LlamaEmbeddingContext.d.ts +2 -10
- package/dist/evaluator/LlamaEmbeddingContext.js +9 -23
- package/dist/evaluator/LlamaEmbeddingContext.js.map +1 -1
- package/dist/evaluator/LlamaGrammar.d.ts +1 -1
- package/dist/evaluator/LlamaModel.d.ts +9 -0
- package/dist/evaluator/LlamaModel.js +2 -1
- package/dist/evaluator/LlamaModel.js.map +1 -1
- package/dist/gguf/insights/GgufInsights.js +12 -12
- package/dist/gguf/insights/GgufInsights.js.map +1 -1
- package/dist/gguf/insights/utils/resolveContextContextSizeOption.js +27 -3
- package/dist/gguf/insights/utils/resolveContextContextSizeOption.js.map +1 -1
- package/dist/gguf/parser/parseGguf.js +5 -0
- package/dist/gguf/parser/parseGguf.js.map +1 -1
- package/dist/gguf/readGgufFileInfo.d.ts +5 -2
- package/dist/gguf/readGgufFileInfo.js +38 -10
- package/dist/gguf/readGgufFileInfo.js.map +1 -1
- package/dist/gguf/types/GgufFileInfoTypes.d.ts +32 -0
- package/dist/gguf/types/GgufFileInfoTypes.js.map +1 -1
- package/dist/gguf/utils/getGgufMetadataArchitectureData.js +1 -1
- package/dist/gguf/utils/getGgufMetadataArchitectureData.js.map +1 -1
- package/dist/gguf/utils/resolveBinarySplitGgufPartUrls.d.ts +2 -0
- package/dist/gguf/utils/resolveBinarySplitGgufPartUrls.js +39 -0
- package/dist/gguf/utils/resolveBinarySplitGgufPartUrls.js.map +1 -0
- package/dist/gguf/utils/resolveSplitGgufParts.d.ts +7 -0
- package/dist/gguf/utils/resolveSplitGgufParts.js +55 -0
- package/dist/gguf/utils/resolveSplitGgufParts.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/LlamaText.d.ts +29 -20
- package/dist/utils/LlamaText.js +253 -243
- package/dist/utils/LlamaText.js.map +1 -1
- package/dist/utils/StopGenerationDetector.d.ts +1 -1
- package/dist/utils/StopGenerationDetector.js +2 -0
- package/dist/utils/StopGenerationDetector.js.map +1 -1
- package/dist/utils/createModelDownloader.d.ts +99 -0
- package/dist/utils/createModelDownloader.js +226 -0
- package/dist/utils/createModelDownloader.js.map +1 -0
- package/dist/utils/findCharacterRemovalCountToFitChatHistoryInContext.js +18 -8
- package/dist/utils/findCharacterRemovalCountToFitChatHistoryInContext.js.map +1 -1
- package/dist/utils/parseTextTemplate.d.ts +2 -2
- package/dist/utils/parseTextTemplate.js +2 -2
- package/dist/utils/runtime.d.ts +4 -0
- package/dist/utils/runtime.js +8 -0
- package/dist/utils/runtime.js.map +1 -0
- package/llama/addon.cpp +18 -7
- package/llama/binariesGithubRelease.json +1 -1
- package/llama/gitRelease.bundle +0 -0
- package/llama/grammars/README.md +1 -1
- package/llama/llama.cpp.info.json +1 -1
- package/llamaBins/linux-arm64/_nlcBuildMetadata.json +1 -1
- package/llamaBins/linux-arm64/llama-addon.node +0 -0
- package/llamaBins/linux-armv7l/_nlcBuildMetadata.json +1 -1
- package/llamaBins/linux-armv7l/llama-addon.node +0 -0
- package/llamaBins/linux-x64/_nlcBuildMetadata.json +1 -1
- package/llamaBins/linux-x64/llama-addon.node +0 -0
- package/llamaBins/linux-x64-cuda/_nlcBuildMetadata.json +1 -1
- package/llamaBins/linux-x64-cuda/llama-addon.node +0 -0
- package/llamaBins/linux-x64-vulkan/_nlcBuildMetadata.json +1 -1
- package/llamaBins/linux-x64-vulkan/llama-addon.node +0 -0
- package/llamaBins/mac-arm64-metal/_nlcBuildMetadata.json +1 -1
- package/llamaBins/mac-arm64-metal/default.metallib +0 -0
- package/llamaBins/mac-arm64-metal/llama-addon.node +0 -0
- package/llamaBins/mac-x64/_nlcBuildMetadata.json +1 -1
- package/llamaBins/mac-x64/llama-addon.node +0 -0
- package/llamaBins/win-arm64/_nlcBuildMetadata.json +1 -1
- package/llamaBins/win-arm64/llama-addon.node +0 -0
- package/llamaBins/win-x64/_nlcBuildMetadata.json +1 -1
- package/llamaBins/win-x64/llama-addon.node +0 -0
- package/llamaBins/win-x64-cuda/_nlcBuildMetadata.json +1 -1
- package/llamaBins/win-x64-cuda/llama-addon.node +0 -0
- package/llamaBins/win-x64-vulkan/_nlcBuildMetadata.json +1 -1
- package/llamaBins/win-x64-vulkan/llama-addon.node +0 -0
- package/package.json +8 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StopGenerationDetector.js","sourceRoot":"","sources":["../../src/utils/StopGenerationDetector.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,WAAW,EAAa,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AAKvF,MA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GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACX,IAAI,OAAO,KAAK,KAAK,QAAQ;gBACzB,OAAO,CAAC,KAAK,CAAC,CAAC;iBACd,IAAI,KAAK,YAAY,YAAY;gBAClC,OAAO,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;iBAChC,IAAI,KAAK,YAAY,iBAAiB;gBACvC,OAAO,KAAK,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAC;YAEtD,OAAO,KAAqB,CAAC;QACjC,CAAC,CAAC;aACD,IAAI,CAAC,CAAC,CAAC,CACf,CAAC;IACN,CAAC;CACJ;AAED,SAAS,mBAAmB,CAAC,WAAkC;IAC3D,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,MAAM,GAAG,GAA0B,EAAE,CAAC;IAEtC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC5B,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC1B,IAAI,IAAI,IAAI,CAAC;YACb,SAAS;SACZ;QAED,IAAI,IAAI,KAAK,EAAE,EAAE;YACb,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,IAAI,GAAG,EAAE,CAAC;SACb;QAED,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAClB;IAED,IAAI,IAAI,KAAK,EAAE;QACX,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEnB,OAAO,GAAG,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export type ModelDownloaderOptions = {
|
|
3
|
+
modelUrl: string;
|
|
4
|
+
/**
|
|
5
|
+
* The directory to save the model file to.
|
|
6
|
+
* Default to `node-llama-cpp`'s default global models directory (`~/.node-llama-cpp/models`).
|
|
7
|
+
*/
|
|
8
|
+
dirPath?: string;
|
|
9
|
+
fileName?: string;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
showCliProgress?: boolean;
|
|
12
|
+
onProgress?: (status: {
|
|
13
|
+
totalSize: number;
|
|
14
|
+
downloadedSize: number;
|
|
15
|
+
}) => void;
|
|
16
|
+
/**
|
|
17
|
+
* If true, the downloader will skip the download if the file already exists, and its size matches the size of the remote file.
|
|
18
|
+
*
|
|
19
|
+
* Defaults to `true`.
|
|
20
|
+
*/
|
|
21
|
+
skipExisting?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* If true, the temporary file will be deleted when the download is canceled.
|
|
24
|
+
*
|
|
25
|
+
* Defaults to `true`.
|
|
26
|
+
*/
|
|
27
|
+
deleteTempFileOnCancel?: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Create a model downloader to download a model from a URL.
|
|
31
|
+
* Uses [`ipull`](https://github.com/ido-pluto/ipull) to download a model file as fast as possible with parallel connections
|
|
32
|
+
* and other optimizations.
|
|
33
|
+
*
|
|
34
|
+
* If the url points to a `.gguf` file that is split into multiple parts (for example, `model-00001-of-00009.gguf`),
|
|
35
|
+
* all the parts will be downloaded to the specified directory.
|
|
36
|
+
*
|
|
37
|
+
* If the url points to a `.gguf` file that is binary spliced into multiple parts (for example, `model.gguf.part1of9`),
|
|
38
|
+
* all the parts will be spliced into a single file and be downloaded to the specified directory.
|
|
39
|
+
*
|
|
40
|
+
* If the url points to a `.gguf` file that is not split or binary spliced (for example, `model.gguf`),
|
|
41
|
+
* the file will be downloaded to the specified directory.
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* import {fileURLToPath} from "url";
|
|
45
|
+
* import path from "path";
|
|
46
|
+
* import {createModelDownloader, getLlama} from "node-llama-cpp";
|
|
47
|
+
*
|
|
48
|
+
* const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
49
|
+
*
|
|
50
|
+
* const downloader = await createModelDownloader({
|
|
51
|
+
* modelUrl: "https://example.com/model.gguf",
|
|
52
|
+
* dirPath: path.join(__dirname, "models")
|
|
53
|
+
* });
|
|
54
|
+
* const modelPath = await downloader.download();
|
|
55
|
+
*
|
|
56
|
+
* const llama = await getLlama();
|
|
57
|
+
* const model = llama.loadModel({
|
|
58
|
+
* modelPath
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function createModelDownloader(options: ModelDownloaderOptions): Promise<ModelDownloader>;
|
|
63
|
+
export declare class ModelDownloader {
|
|
64
|
+
private constructor();
|
|
65
|
+
/**
|
|
66
|
+
* The filename of the entrypoint file that should be used to load the model.
|
|
67
|
+
*/
|
|
68
|
+
get entrypointFilename(): string;
|
|
69
|
+
/**
|
|
70
|
+
* The full path to the entrypoint file that should be used to load the model.
|
|
71
|
+
*/
|
|
72
|
+
get entrypointFilePath(): string;
|
|
73
|
+
/**
|
|
74
|
+
* If the model is binary spliced from multiple parts, this will return the number of those binary parts.
|
|
75
|
+
*/
|
|
76
|
+
get splitBinaryParts(): number | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* The total number of files that will be saved to the directory.
|
|
79
|
+
* For split files, this will be the number of split parts, as multiple files will be saved.
|
|
80
|
+
* For binary-split files, this will be 1, as the parts will be spliced into a single file.
|
|
81
|
+
*/
|
|
82
|
+
get totalFiles(): number;
|
|
83
|
+
get totalSize(): number;
|
|
84
|
+
get downloadedSize(): number;
|
|
85
|
+
/**
|
|
86
|
+
* @returns The path to the entrypoint file that should be used to load the model
|
|
87
|
+
*/
|
|
88
|
+
download({ signal }?: {
|
|
89
|
+
signal?: AbortSignal;
|
|
90
|
+
}): Promise<string>;
|
|
91
|
+
cancel({ deleteTempFile }?: {
|
|
92
|
+
/**
|
|
93
|
+
* Delete the temporary file that was created during the download.
|
|
94
|
+
*
|
|
95
|
+
* Defaults to the value of `deleteTempFileOnCancel` in the constructor.
|
|
96
|
+
*/
|
|
97
|
+
deleteTempFile?: boolean;
|
|
98
|
+
}): Promise<void>;
|
|
99
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import process from "process";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { downloadFile, downloadSequence } from "ipull";
|
|
4
|
+
import fs from "fs-extra";
|
|
5
|
+
import { normalizeGgufDownloadUrl } from "../gguf/utils/normalizeGgufDownloadUrl.js";
|
|
6
|
+
import { createSplitPartFilename, resolveSplitGgufParts } from "../gguf/utils/resolveSplitGgufParts.js";
|
|
7
|
+
import { getFilenameForBinarySplitGgufPartUrls, resolveBinarySplitGgufPartUrls } from "../gguf/utils/resolveBinarySplitGgufPartUrls.js";
|
|
8
|
+
import { cliModelsDirectory } from "../config.js";
|
|
9
|
+
/**
|
|
10
|
+
* Create a model downloader to download a model from a URL.
|
|
11
|
+
* Uses [`ipull`](https://github.com/ido-pluto/ipull) to download a model file as fast as possible with parallel connections
|
|
12
|
+
* and other optimizations.
|
|
13
|
+
*
|
|
14
|
+
* If the url points to a `.gguf` file that is split into multiple parts (for example, `model-00001-of-00009.gguf`),
|
|
15
|
+
* all the parts will be downloaded to the specified directory.
|
|
16
|
+
*
|
|
17
|
+
* If the url points to a `.gguf` file that is binary spliced into multiple parts (for example, `model.gguf.part1of9`),
|
|
18
|
+
* all the parts will be spliced into a single file and be downloaded to the specified directory.
|
|
19
|
+
*
|
|
20
|
+
* If the url points to a `.gguf` file that is not split or binary spliced (for example, `model.gguf`),
|
|
21
|
+
* the file will be downloaded to the specified directory.
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import {fileURLToPath} from "url";
|
|
25
|
+
* import path from "path";
|
|
26
|
+
* import {createModelDownloader, getLlama} from "node-llama-cpp";
|
|
27
|
+
*
|
|
28
|
+
* const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
29
|
+
*
|
|
30
|
+
* const downloader = await createModelDownloader({
|
|
31
|
+
* modelUrl: "https://example.com/model.gguf",
|
|
32
|
+
* dirPath: path.join(__dirname, "models")
|
|
33
|
+
* });
|
|
34
|
+
* const modelPath = await downloader.download();
|
|
35
|
+
*
|
|
36
|
+
* const llama = await getLlama();
|
|
37
|
+
* const model = llama.loadModel({
|
|
38
|
+
* modelPath
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export async function createModelDownloader(options) {
|
|
43
|
+
const downloader = ModelDownloader._create(options);
|
|
44
|
+
await downloader._init();
|
|
45
|
+
return downloader;
|
|
46
|
+
}
|
|
47
|
+
export class ModelDownloader {
|
|
48
|
+
/** @internal */ _modelUrl;
|
|
49
|
+
/** @internal */ _dirPath;
|
|
50
|
+
/** @internal */ _fileName;
|
|
51
|
+
/** @internal */ _headers;
|
|
52
|
+
/** @internal */ _showCliProgress;
|
|
53
|
+
/** @internal */ _onProgress;
|
|
54
|
+
/** @internal */ _deleteTempFileOnCancel;
|
|
55
|
+
/** @internal */ _skipExisting;
|
|
56
|
+
/** @internal */ _downloader;
|
|
57
|
+
/** @internal */ _specificFileDownloaders = [];
|
|
58
|
+
/** @internal */ _entrypointFilename;
|
|
59
|
+
/** @internal */ _splitBinaryParts;
|
|
60
|
+
/** @internal */ _totalFiles;
|
|
61
|
+
constructor({ modelUrl, dirPath = cliModelsDirectory, fileName, headers, showCliProgress = false, onProgress, deleteTempFileOnCancel = true, skipExisting = true }) {
|
|
62
|
+
if (modelUrl == null || dirPath == null)
|
|
63
|
+
throw new Error("modelUrl and dirPath cannot be null");
|
|
64
|
+
this._modelUrl = normalizeGgufDownloadUrl(modelUrl);
|
|
65
|
+
this._dirPath = path.resolve(process.cwd(), dirPath);
|
|
66
|
+
this._fileName = fileName;
|
|
67
|
+
this._headers = headers;
|
|
68
|
+
this._showCliProgress = showCliProgress;
|
|
69
|
+
this._onProgress = onProgress;
|
|
70
|
+
this._deleteTempFileOnCancel = deleteTempFileOnCancel;
|
|
71
|
+
this._skipExisting = skipExisting;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The filename of the entrypoint file that should be used to load the model.
|
|
75
|
+
*/
|
|
76
|
+
get entrypointFilename() {
|
|
77
|
+
return this._entrypointFilename;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The full path to the entrypoint file that should be used to load the model.
|
|
81
|
+
*/
|
|
82
|
+
get entrypointFilePath() {
|
|
83
|
+
return path.join(this._dirPath, this.entrypointFilename);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* If the model is binary spliced from multiple parts, this will return the number of those binary parts.
|
|
87
|
+
*/
|
|
88
|
+
get splitBinaryParts() {
|
|
89
|
+
return this._splitBinaryParts;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The total number of files that will be saved to the directory.
|
|
93
|
+
* For split files, this will be the number of split parts, as multiple files will be saved.
|
|
94
|
+
* For binary-split files, this will be 1, as the parts will be spliced into a single file.
|
|
95
|
+
*/
|
|
96
|
+
get totalFiles() {
|
|
97
|
+
return this._totalFiles;
|
|
98
|
+
}
|
|
99
|
+
get totalSize() {
|
|
100
|
+
return this._downloader.downloadStatues
|
|
101
|
+
.map(status => status.totalBytes)
|
|
102
|
+
.reduce((acc, totalBytes) => acc + totalBytes, 0);
|
|
103
|
+
}
|
|
104
|
+
get downloadedSize() {
|
|
105
|
+
return this._downloader.downloadStatues
|
|
106
|
+
.map(status => status.transferredBytes)
|
|
107
|
+
.reduce((acc, transferredBytes) => acc + transferredBytes, 0);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @returns The path to the entrypoint file that should be used to load the model
|
|
111
|
+
*/
|
|
112
|
+
async download({ signal } = {}) {
|
|
113
|
+
if (signal?.aborted)
|
|
114
|
+
throw signal.reason;
|
|
115
|
+
if (this._skipExisting) {
|
|
116
|
+
if (this._specificFileDownloaders.length === 1 && await fs.pathExists(this.entrypointFilePath)) {
|
|
117
|
+
const fileStat = await fs.stat(this.entrypointFilePath);
|
|
118
|
+
if (this._specificFileDownloaders[0].status.totalBytes === fileStat.size)
|
|
119
|
+
return this.entrypointFilePath;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
// TODO: skip existing split files
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const onAbort = () => {
|
|
126
|
+
signal?.removeEventListener("abort", onAbort);
|
|
127
|
+
this.cancel();
|
|
128
|
+
};
|
|
129
|
+
if (signal != null)
|
|
130
|
+
signal.addEventListener("abort", onAbort);
|
|
131
|
+
try {
|
|
132
|
+
if (this._onProgress)
|
|
133
|
+
this._downloader.on("progress", this._onDownloadProgress);
|
|
134
|
+
await this._downloader.download();
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
if (signal?.aborted)
|
|
138
|
+
throw signal.reason;
|
|
139
|
+
throw err;
|
|
140
|
+
}
|
|
141
|
+
finally {
|
|
142
|
+
if (this._onProgress)
|
|
143
|
+
this._downloader.off("progress", this._onDownloadProgress);
|
|
144
|
+
if (signal != null)
|
|
145
|
+
signal.removeEventListener("abort", onAbort);
|
|
146
|
+
}
|
|
147
|
+
return this.entrypointFilePath;
|
|
148
|
+
}
|
|
149
|
+
async cancel({ deleteTempFile = this._deleteTempFileOnCancel } = {}) {
|
|
150
|
+
for (const downloader of this._specificFileDownloaders) {
|
|
151
|
+
if (deleteTempFile)
|
|
152
|
+
await downloader.closeAndDeleteFile();
|
|
153
|
+
else
|
|
154
|
+
await downloader.close();
|
|
155
|
+
}
|
|
156
|
+
if (this._downloader !== this._specificFileDownloaders[0])
|
|
157
|
+
await this._downloader?.close();
|
|
158
|
+
}
|
|
159
|
+
/** @internal */
|
|
160
|
+
_onDownloadProgress() {
|
|
161
|
+
this._onProgress?.({
|
|
162
|
+
totalSize: this.totalSize,
|
|
163
|
+
downloadedSize: this.downloadedSize
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/** @internal */
|
|
167
|
+
async _init() {
|
|
168
|
+
const binarySplitPartUrls = resolveBinarySplitGgufPartUrls(this._modelUrl);
|
|
169
|
+
await fs.ensureDir(this._dirPath);
|
|
170
|
+
if (binarySplitPartUrls instanceof Array) {
|
|
171
|
+
this._downloader = await downloadFile({
|
|
172
|
+
partURLs: binarySplitPartUrls,
|
|
173
|
+
directory: this._dirPath,
|
|
174
|
+
fileName: this._fileName ?? getFilenameForBinarySplitGgufPartUrls(binarySplitPartUrls),
|
|
175
|
+
cliProgress: this._showCliProgress,
|
|
176
|
+
headers: this._headers ?? {}
|
|
177
|
+
});
|
|
178
|
+
this._specificFileDownloaders.push(this._downloader);
|
|
179
|
+
this._entrypointFilename = this._downloader.fileName;
|
|
180
|
+
this._splitBinaryParts = binarySplitPartUrls.length;
|
|
181
|
+
this._totalFiles = 1;
|
|
182
|
+
if (this._downloader.fileName == null || this._downloader.fileName === "")
|
|
183
|
+
throw new Error("Failed to get the file name from the given URL");
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const splitGgufPartUrls = resolveSplitGgufParts(this._modelUrl);
|
|
187
|
+
if (splitGgufPartUrls.length === 1) {
|
|
188
|
+
this._downloader = await downloadFile({
|
|
189
|
+
url: splitGgufPartUrls[0],
|
|
190
|
+
directory: this._dirPath,
|
|
191
|
+
fileName: this._fileName ?? undefined,
|
|
192
|
+
cliProgress: this._showCliProgress,
|
|
193
|
+
headers: this._headers ?? {}
|
|
194
|
+
});
|
|
195
|
+
this._specificFileDownloaders.push(this._downloader);
|
|
196
|
+
this._entrypointFilename = this._downloader.fileName;
|
|
197
|
+
this._totalFiles = 1;
|
|
198
|
+
if (this._downloader.fileName == null || this._downloader.fileName === "")
|
|
199
|
+
throw new Error("Failed to get the file name from the given URL");
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const partDownloads = splitGgufPartUrls.map((url, index) => downloadFile({
|
|
203
|
+
url,
|
|
204
|
+
directory: this._dirPath,
|
|
205
|
+
fileName: this._fileName != null
|
|
206
|
+
? createSplitPartFilename(this._fileName, index + 1, splitGgufPartUrls.length)
|
|
207
|
+
: undefined,
|
|
208
|
+
headers: this._headers ?? {}
|
|
209
|
+
}));
|
|
210
|
+
this._downloader = await downloadSequence({
|
|
211
|
+
cliProgress: this._showCliProgress
|
|
212
|
+
}, ...partDownloads);
|
|
213
|
+
const firstDownload = await partDownloads[0];
|
|
214
|
+
this._specificFileDownloaders = await Promise.all(partDownloads);
|
|
215
|
+
this._entrypointFilename = firstDownload.fileName;
|
|
216
|
+
this._totalFiles = partDownloads.length;
|
|
217
|
+
if (this._entrypointFilename == null || this._entrypointFilename === "")
|
|
218
|
+
throw new Error("Failed to get the file name from the given URL");
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
/** @internal */
|
|
222
|
+
static _create(options) {
|
|
223
|
+
return new ModelDownloader(options);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=createModelDownloader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createModelDownloader.js","sourceRoot":"","sources":["../../src/utils/createModelDownloader.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAoD,YAAY,EAAE,gBAAgB,EAAC,MAAM,OAAO,CAAC;AACxG,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAC,wBAAwB,EAAC,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAC,uBAAuB,EAAE,qBAAqB,EAAC,MAAM,wCAAwC,CAAC;AACtG,OAAO,EAAC,qCAAqC,EAAE,8BAA8B,EAAC,MAAM,iDAAiD,CAAC;AACtI,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AA+BhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAA+B;IACvE,MAAM,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;IACzB,OAAO,UAAU,CAAC;AACtB,CAAC;AAED,MAAM,OAAO,eAAe;IACxB,gBAAgB,CAAkB,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EAAE,IAAI,CAAC,gBAAgB;SACrC,EACD,GAAG,aAAa,CACnB,CAAC;QACF,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,wBAAwB,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAEjE,IAAI,CAAC,mBAAmB,GAAG,aAAa,CAAC,QAAQ,CAAC;QAClD,IAAI,CAAC,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC;QAExC,IAAI,IAAI,CAAC,mBAAmB,IAAI,IAAI,IAAI,IAAI,CAAC,mBAAmB,KAAK,EAAE;YACnE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAEtE,OAAO;IACX,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,OAAO,CAAC,OAA+B;QACjD,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;CACJ"}
|
|
@@ -29,15 +29,18 @@ export async function findCharacterRemovalCountToFitChatHistoryInContext({ compr
|
|
|
29
29
|
removedCharactersCount: initialCharactersRemovalCount,
|
|
30
30
|
compressedChatHistory: latestCompressionAttempt.compressedHistory
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
let bestCompressionAttempt = latestCompressionAttempt;
|
|
33
|
+
for (let compressionAttempts = 0, decompressionAttempts = 0; bestCompressionAttempt.tokensCount !== tokensCountToFit;) {
|
|
33
34
|
if (compressionAttempts > 0) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
if (latestCompressionAttempt.tokensCount != firstCompressionAttempt.tokensCount &&
|
|
36
|
+
latestCompressionAttempt.characterRemovalCount != firstCompressionAttempt.characterRemovalCount)
|
|
37
|
+
currentEstimatedCharactersPerToken =
|
|
38
|
+
Math.abs(latestCompressionAttempt.characterRemovalCount - firstCompressionAttempt.characterRemovalCount) /
|
|
39
|
+
Math.abs(latestCompressionAttempt.tokensCount - firstCompressionAttempt.tokensCount);
|
|
40
|
+
if (!Number.isFinite(currentEstimatedCharactersPerToken) || currentEstimatedCharactersPerToken === 0)
|
|
38
41
|
currentEstimatedCharactersPerToken = estimatedCharactersPerToken;
|
|
39
42
|
}
|
|
40
|
-
const tokensLeftToRemove =
|
|
43
|
+
const tokensLeftToRemove = latestCompressionAttempt.tokensCount - tokensCountToFit;
|
|
41
44
|
let additionalCharactersToRemove = Math.round(tokensLeftToRemove * currentEstimatedCharactersPerToken);
|
|
42
45
|
if (additionalCharactersToRemove === 0) {
|
|
43
46
|
if (tokensLeftToRemove > 0)
|
|
@@ -52,10 +55,17 @@ export async function findCharacterRemovalCountToFitChatHistoryInContext({ compr
|
|
|
52
55
|
if (decompressionAttempts >= maxDecompressionAttempts)
|
|
53
56
|
break;
|
|
54
57
|
latestCompressionAttempt = await getResultForCharacterRemovalCount(latestCompressionAttempt.characterRemovalCount + additionalCharactersToRemove);
|
|
58
|
+
if ((bestCompressionAttempt.tokensCount > tokensCountToFit &&
|
|
59
|
+
latestCompressionAttempt.tokensCount <= bestCompressionAttempt.tokensCount) || (bestCompressionAttempt.tokensCount < tokensCountToFit &&
|
|
60
|
+
latestCompressionAttempt.tokensCount < tokensCountToFit &&
|
|
61
|
+
latestCompressionAttempt.tokensCount > bestCompressionAttempt.tokensCount) || (bestCompressionAttempt.tokensCount <= tokensCountToFit &&
|
|
62
|
+
latestCompressionAttempt.tokensCount <= tokensCountToFit &&
|
|
63
|
+
latestCompressionAttempt.characterRemovalCount < bestCompressionAttempt.characterRemovalCount))
|
|
64
|
+
bestCompressionAttempt = latestCompressionAttempt;
|
|
55
65
|
}
|
|
56
66
|
return {
|
|
57
|
-
removedCharactersCount:
|
|
58
|
-
compressedChatHistory:
|
|
67
|
+
removedCharactersCount: bestCompressionAttempt.characterRemovalCount,
|
|
68
|
+
compressedChatHistory: bestCompressionAttempt.compressedHistory
|
|
59
69
|
};
|
|
60
70
|
}
|
|
61
71
|
//# sourceMappingURL=findCharacterRemovalCountToFitChatHistoryInContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findCharacterRemovalCountToFitChatHistoryInContext.js","sourceRoot":"","sources":["../../src/utils/findCharacterRemovalCountToFitChatHistoryInContext.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,kDAAkD,CAAC,EACrE,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,6BAA6B,GAAG,CAAC,EACjC,2BAA2B,GAAG,CAAC,EAC/B,wBAAwB,GAAG,CAAC,EAY/B;IAIG,SAAS,4BAA4B,CAAC,WAAuC;QACzE,MAAM,EAAC,WAAW,EAAC,GAAG,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;QACnE,OAAO,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IAClD,CAAC;IAED,KAAK,UAAU,iCAAiC,CAAC,qBAA6B;QAC1E,IAAI,qBAAqB,KAAK,CAAC;YAC3B,OAAO;gBACH,iBAAiB,EAAE,WAAW;gBAC9B,WAAW,EAAE,4BAA4B,CAAC,WAAW,CAAC;gBACtD,qBAAqB;aACxB,CAAC;QAEN,MAAM,iBAAiB,GAAG,MAAM,mBAAmB,CAAC;YAChD,WAAW;YACX,kBAAkB,EAAE,qBAAqB;SAC5C,CAAC,CAAC;QAEH,OAAO;YACH,iBAAiB;YACjB,WAAW,EAAE,4BAA4B,CAAC,iBAAiB,CAAC;YAC5D,qBAAqB;SACxB,CAAC;IACN,CAAC;IAED,IAAI,wBAAwB,GAAG,MAAM,iCAAiC,CAAC,6BAA6B,CAAC,CAAC;IACtG,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;IACzD,IAAI,kCAAkC,GAAG,2BAA2B,CAAC;IAErE,IAAI,wBAAwB,CAAC,WAAW,KAAK,gBAAgB;QACzD,CAAC,wBAAwB,CAAC,WAAW,GAAG,gBAAgB,IAAI,wBAAwB,CAAC,qBAAqB,KAAK,CAAC,CAAC;QAEjH,OAAO;YACH,sBAAsB,EAAE,6BAA6B;YACrD,qBAAqB,EAAE,wBAAwB,CAAC,iBAAiB;SACpE,CAAC;IAEN,KACI,IAAI,mBAAmB,GAAG,CAAC,EAAE,qBAAqB,GAAG,CAAC,EACtD,
|
|
1
|
+
{"version":3,"file":"findCharacterRemovalCountToFitChatHistoryInContext.js","sourceRoot":"","sources":["../../src/utils/findCharacterRemovalCountToFitChatHistoryInContext.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,kDAAkD,CAAC,EACrE,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,6BAA6B,GAAG,CAAC,EACjC,2BAA2B,GAAG,CAAC,EAC/B,wBAAwB,GAAG,CAAC,EAY/B;IAIG,SAAS,4BAA4B,CAAC,WAAuC;QACzE,MAAM,EAAC,WAAW,EAAC,GAAG,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;QACnE,OAAO,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IAClD,CAAC;IAED,KAAK,UAAU,iCAAiC,CAAC,qBAA6B;QAC1E,IAAI,qBAAqB,KAAK,CAAC;YAC3B,OAAO;gBACH,iBAAiB,EAAE,WAAW;gBAC9B,WAAW,EAAE,4BAA4B,CAAC,WAAW,CAAC;gBACtD,qBAAqB;aACxB,CAAC;QAEN,MAAM,iBAAiB,GAAG,MAAM,mBAAmB,CAAC;YAChD,WAAW;YACX,kBAAkB,EAAE,qBAAqB;SAC5C,CAAC,CAAC;QAEH,OAAO;YACH,iBAAiB;YACjB,WAAW,EAAE,4BAA4B,CAAC,iBAAiB,CAAC;YAC5D,qBAAqB;SACxB,CAAC;IACN,CAAC;IAED,IAAI,wBAAwB,GAAG,MAAM,iCAAiC,CAAC,6BAA6B,CAAC,CAAC;IACtG,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;IACzD,IAAI,kCAAkC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ED,IAAI,kBAAkB,GAAG,CAAC;YACtB,mBAAmB,EAAE,CAAC;aACrB,IAAI,kBAAkB,GAAG,CAAC;YAC3B,qBAAqB,EAAE,CAAC;QAE5B,IAAI,qBAAqB,IAAI,wBAAwB;YACjD,MAAM;QAEV,wBAAwB,GAAG,MAAM,iCAAiC,CAC9D,wBAAwB,CAAC,qBAAqB,GAAG,4BAA4B,CAChF,CAAC;QAEF,IAAI,CACA,sBAAsB,CAAC,WAAW,GAAG,gBAAgB;YACrD,wBAAwB,CAAC,WAAW,IAAI,sBAAsB,CAAC,WAAW,CAC7E,IAAI,CACD,sBAAsB,CAAC,WAAW,GAAG,gBAAgB;YACrD,wBAAwB,CAAC,WAAW,GAAG,gBAAgB;YACvD,wBAAwB,CAAC,WAAW,GAAG,sBAAsB,CAAC,WAAW,CAC5E,IAAI,CACD,sBAAsB,CAAC,WAAW,IAAI,gBAAgB;YACtD,wBAAwB,CAAC,WAAW,IAAI,gBAAgB;YACxD,wBAAwB,CAAC,qBAAqB,GAAG,sBAAsB,CAAC,qBAAqB,CAChG;YACG,sBAAsB,GAAG,wBAAwB,CAAC;KACzD;IAED,OAAO;QACH,sBAAsB,EAAE,sBAAsB,CAAC,qBAAqB;QACpE,qBAAqB,EAAE,sBAAsB,CAAC,iBAAiB;KAClE,CAAC;AACN,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { MergeUnionTypes } from "./mergeUnionTypes.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Parses a text template into a map of parts and their prefixes and suffixes.
|
|
4
4
|
* This parser assumes each part occurs exactly once in the template, and that all parts must occur in the order they are defined.
|
|
5
|
-
*
|
|
5
|
+
* @example
|
|
6
6
|
* ```typescript
|
|
7
7
|
* const res = parseTextTemplate(
|
|
8
8
|
* "Hello, {{name}}! What is the {{thing}}?",
|
|
@@ -25,7 +25,7 @@ import { MergeUnionTypes } from "./mergeUnionTypes.js";
|
|
|
25
25
|
* }
|
|
26
26
|
* });
|
|
27
27
|
* ```
|
|
28
|
-
*
|
|
28
|
+
* @example
|
|
29
29
|
* ```typescript
|
|
30
30
|
* const res2 = parseTextTemplate(
|
|
31
31
|
* "What is the {{thing}}?",
|
|
@@ -2,7 +2,7 @@ import { splitText } from "lifecycle-utils";
|
|
|
2
2
|
/**
|
|
3
3
|
* Parses a text template into a map of parts and their prefixes and suffixes.
|
|
4
4
|
* This parser assumes each part occurs exactly once in the template, and that all parts must occur in the order they are defined.
|
|
5
|
-
*
|
|
5
|
+
* @example
|
|
6
6
|
* ```typescript
|
|
7
7
|
* const res = parseTextTemplate(
|
|
8
8
|
* "Hello, {{name}}! What is the {{thing}}?",
|
|
@@ -25,7 +25,7 @@ import { splitText } from "lifecycle-utils";
|
|
|
25
25
|
* }
|
|
26
26
|
* });
|
|
27
27
|
* ```
|
|
28
|
-
*
|
|
28
|
+
* @example
|
|
29
29
|
* ```typescript
|
|
30
30
|
* const res2 = parseTextTemplate(
|
|
31
31
|
* "What is the {{thing}}?",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { fileURLToPath } from "url";
|
|
3
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
4
|
+
export const runningInElectron = process.versions.electron != null;
|
|
5
|
+
export const runningInsideAsar = runningInElectron && __filename.toLowerCase().includes(".asar" + path.sep);
|
|
6
|
+
export const runningInBun = process.versions.bun != null;
|
|
7
|
+
export const runningInNode = !runningInElectron && !runningInBun;
|
|
8
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/utils/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,aAAa,EAAC,MAAM,KAAK,CAAC;AAElC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAElD,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,IAAI,IAAI,CAAC;AACnE,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5G,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,IAAI,CAAC;AACzD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,iBAAiB,IAAI,CAAC,YAAY,CAAC"}
|
package/llama/addon.cpp
CHANGED
|
@@ -289,6 +289,10 @@ class AddonModel : public Napi::ObjectWrap<AddonModel> {
|
|
|
289
289
|
model_params.use_mlock = options.Get("useMlock").As<Napi::Boolean>().Value();
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
+
if (options.Has("checkTensors")) {
|
|
293
|
+
model_params.check_tensors = options.Get("checkTensors").As<Napi::Boolean>().Value();
|
|
294
|
+
}
|
|
295
|
+
|
|
292
296
|
if (options.Has("onLoadProgress")) {
|
|
293
297
|
auto onLoadProgressJSCallback = options.Get("onLoadProgress").As<Napi::Function>();
|
|
294
298
|
if (onLoadProgressJSCallback.IsFunction()) {
|
|
@@ -1483,6 +1487,11 @@ class AddonContextSampleTokenWorker : public Napi::AsyncWorker {
|
|
|
1483
1487
|
llama_token new_token_id = 0;
|
|
1484
1488
|
|
|
1485
1489
|
// Select the best prediction.
|
|
1490
|
+
if (llama_get_logits(ctx->ctx) == nullptr) {
|
|
1491
|
+
SetError("This model does not support token generation");
|
|
1492
|
+
return;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1486
1495
|
auto logits = llama_get_logits_ith(ctx->ctx, batchLogitIndex);
|
|
1487
1496
|
auto n_vocab = llama_n_vocab(ctx->model->model);
|
|
1488
1497
|
|
|
@@ -1701,13 +1710,15 @@ static void addonLlamaCppLogCallback(ggml_log_level level, const char* text, voi
|
|
|
1701
1710
|
}
|
|
1702
1711
|
}
|
|
1703
1712
|
|
|
1704
|
-
if (
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1713
|
+
if (text != nullptr) {
|
|
1714
|
+
if (level == 2) {
|
|
1715
|
+
fputs(text, stderr);
|
|
1716
|
+
fflush(stderr);
|
|
1717
|
+
} else {
|
|
1718
|
+
fputs(text, stdout);
|
|
1719
|
+
fflush(stdout);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1711
1722
|
}
|
|
1712
1723
|
|
|
1713
1724
|
Napi::Value setLogger(const Napi::CallbackInfo& info) {
|
package/llama/gitRelease.bundle
CHANGED
|
Binary file
|
package/llama/grammars/README.md
CHANGED
|
@@ -51,7 +51,7 @@ single-line ::= [^\n]+ "\n"`
|
|
|
51
51
|
|
|
52
52
|
## Sequences and Alternatives
|
|
53
53
|
|
|
54
|
-
The order of symbols in a sequence
|
|
54
|
+
The order of symbols in a sequence matters. For example, in `"1. " move " " move "\n"`, the `"1. "` must come before the first `move`, etc.
|
|
55
55
|
|
|
56
56
|
Alternatives, denoted by `|`, give different sequences that are acceptable. For example, in `move ::= pawn | nonpawn | castle`, `move` can be a `pawn` move, a `nonpawn` move, or a `castle`.
|
|
57
57
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"22.04"},"arch":"arm64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"
|
|
1
|
+
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"22.04"},"arch":"arm64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b2834"}}}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"22.04"},"arch":"armv7l","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"
|
|
1
|
+
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"22.04"},"arch":"armv7l","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b2834"}}}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"22.04"},"arch":"x64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"
|
|
1
|
+
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"22.04"},"arch":"x64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b2834"}}}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"22.04"},"arch":"x64","gpu":"cuda","llamaCpp":{"repo":"ggerganov/llama.cpp","release":"
|
|
1
|
+
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"22.04"},"arch":"x64","gpu":"cuda","llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b2834"}}}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"22.04"},"arch":"x64","gpu":"vulkan","llamaCpp":{"repo":"ggerganov/llama.cpp","release":"
|
|
1
|
+
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"22.04"},"arch":"x64","gpu":"vulkan","llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b2834"}}}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"mac","platformInfo":{"name":"macOS","version":"21.6.0"},"arch":"arm64","gpu":"metal","llamaCpp":{"repo":"ggerganov/llama.cpp","release":"
|
|
1
|
+
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"mac","platformInfo":{"name":"macOS","version":"21.6.0"},"arch":"arm64","gpu":"metal","llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b2834"}}}
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"mac","platformInfo":{"name":"macOS","version":"21.6.0"},"arch":"x64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"
|
|
1
|
+
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"mac","platformInfo":{"name":"macOS","version":"21.6.0"},"arch":"x64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b2834"}}}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"win","platformInfo":{"name":"Windows","version":"10.0.20348"},"arch":"arm64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"
|
|
1
|
+
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"win","platformInfo":{"name":"Windows","version":"10.0.20348"},"arch":"arm64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b2834"}}}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"win","platformInfo":{"name":"Windows","version":"10.0.20348"},"arch":"x64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"
|
|
1
|
+
{"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"win","platformInfo":{"name":"Windows","version":"10.0.20348"},"arch":"x64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b2834"}}}
|