Skip to content

Commit 5d07289

Browse files
authored
chore: update modules (#411)
1 parent 632a7bf commit 5d07289

File tree

13 files changed

+4229
-4049
lines changed

13 files changed

+4229
-4049
lines changed

package-lock.json

Lines changed: 4117 additions & 3942 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -127,74 +127,74 @@
127127
},
128128
"homepage": "https://node-llama-cpp.withcat.ai",
129129
"devDependencies": {
130-
"@commitlint/cli": "^19.6.0",
130+
"@commitlint/cli": "^19.6.1",
131131
"@commitlint/config-conventional": "^19.6.0",
132-
"@eslint/compat": "^1.2.3",
133-
"@fontsource/inter": "^5.1.0",
134-
"@nolebase/vitepress-plugin-git-changelog": "^2.11.1",
135-
"@nolebase/vitepress-plugin-og-image": "^2.11.1",
132+
"@eslint/compat": "^1.2.4",
133+
"@fontsource/inter": "^5.1.1",
134+
"@nolebase/vitepress-plugin-git-changelog": "^2.12.0",
135+
"@nolebase/vitepress-plugin-og-image": "^2.12.0",
136136
"@resvg/resvg-js": "^2.6.2",
137137
"@semantic-release/exec": "^6.0.3",
138138
"@semantic-release/github": "11.0.1",
139139
"@semantic-release/npm": "12.0.1",
140-
"@shikijs/vitepress-twoslash": "^1.24.0",
141-
"@stylistic/eslint-plugin": "^2.11.0",
140+
"@shikijs/vitepress-twoslash": "^1.26.1",
141+
"@stylistic/eslint-plugin": "^2.12.1",
142142
"@types/async-retry": "^1.4.9",
143-
"@types/bytes": "^3.1.4",
144-
"@types/cross-spawn": "^6.0.2",
143+
"@types/bytes": "^3.1.5",
144+
"@types/cross-spawn": "^6.0.6",
145145
"@types/fs-extra": "^11.0.4",
146-
"@types/node": "^22.10.1",
146+
"@types/node": "^22.10.5",
147147
"@types/proper-lockfile": "^4.1.4",
148148
"@types/semver": "^7.5.8",
149149
"@types/validate-npm-package-name": "^4.0.2",
150150
"@types/which": "^3.0.4",
151151
"@types/yargs": "^17.0.33",
152-
"@vitest/coverage-v8": "^2.1.6",
153-
"@vitest/ui": "^2.1.6",
154-
"electron": "^33.2.1",
155-
"eslint": "^9.16.0",
156-
"eslint-import-resolver-typescript": "^3.6.3",
152+
"@vitest/coverage-v8": "^2.1.8",
153+
"@vitest/ui": "^2.1.8",
154+
"electron": "^33.3.1",
155+
"eslint": "^9.17.0",
156+
"eslint-import-resolver-typescript": "^3.7.0",
157157
"eslint-plugin-import": "^2.31.0",
158-
"eslint-plugin-jsdoc": "^50.6.0",
159-
"eslint-plugin-n": "^17.14.0",
158+
"eslint-plugin-jsdoc": "^50.6.1",
159+
"eslint-plugin-n": "^17.15.1",
160160
"feed": "^4.2.2",
161161
"husky": "^9.1.7",
162-
"rehype": "^13.0.1",
162+
"rehype": "^13.0.2",
163163
"rimraf": "^6.0.1",
164-
"semantic-release": "^24.2.0",
164+
"semantic-release": "^24.2.1",
165165
"sharp": "^0.33.5",
166166
"tslib": "^2.8.1",
167-
"typedoc": "^0.27.2",
168-
"typedoc-plugin-markdown": "^4.3.1",
169-
"typedoc-plugin-mdn-links": "^4.0.3",
170-
"typedoc-vitepress-theme": "^1.1.0",
167+
"typedoc": "^0.27.6",
168+
"typedoc-plugin-markdown": "^4.4.1",
169+
"typedoc-plugin-mdn-links": "^4.0.7",
170+
"typedoc-vitepress-theme": "^1.1.1",
171171
"typescript": "^5.7.2",
172-
"typescript-eslint": "^8.16.0",
173-
"vite-node": "^2.1.6",
172+
"typescript-eslint": "^8.19.1",
173+
"vite-node": "^2.1.8",
174174
"vitepress": "^1.5.0",
175-
"vitest": "^2.1.6",
176-
"zx": "^8.2.4"
175+
"vitest": "^2.1.8",
176+
"zx": "^8.3.0"
177177
},
178178
"dependencies": {
179179
"@huggingface/jinja": "^0.3.2",
180180
"async-retry": "^1.3.3",
181181
"bytes": "^3.1.2",
182-
"chalk": "^5.3.0",
182+
"chalk": "^5.4.1",
183183
"chmodrp": "^1.0.2",
184184
"cmake-js": "^7.3.0",
185185
"cross-env": "^7.0.3",
186186
"cross-spawn": "^7.0.6",
187187
"env-var": "^7.5.0",
188188
"filenamify": "^6.0.0",
189189
"fs-extra": "^11.2.0",
190-
"ignore": "^5.3.2",
190+
"ignore": "^7.0.0",
191191
"ipull": "^3.9.2",
192192
"is-unicode-supported": "^2.1.0",
193193
"lifecycle-utils": "^2.0.0",
194194
"log-symbols": "^7.0.0",
195195
"nanoid": "^5.0.9",
196196
"node-addon-api": "^8.3.0",
197-
"octokit": "^4.0.2",
197+
"octokit": "^4.0.3",
198198
"ora": "^8.1.1",
199199
"pretty-ms": "^9.2.0",
200200
"proper-lockfile": "^4.1.2",

src/cli/commands/DebugCommand.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import os from "os";
22
import {CommandModule} from "yargs";
3-
import bytes from "bytes";
43
import chalk from "chalk";
54
import {getLlama} from "../../bindings/getLlama.js";
65
import {prettyPrintObject} from "../../utils/prettyPrintObject.js";
76
import {logUsedGpuTypeOption} from "../utils/logUsedGpuTypeOption.js";
7+
import {toBytes} from "../utils/toBytes.js";
88

99
const debugFunctions = ["vram", "cmakeOptions"] as const;
1010
type DebugCommand = {
@@ -51,11 +51,11 @@ async function DebugVramFunction() {
5151
logUsedGpuTypeOption(llama.gpu);
5252
console.info();
5353

54-
console.info(`${chalk.yellow("Used VRAM:")} ${getPercentageString(vramStatus.used, vramStatus.total)}% ${chalk.gray("(" + bytes(vramStatus.used) + "/" + bytes(vramStatus.total) + ")")}`);
55-
console.info(`${chalk.yellow("Free VRAM:")} ${getPercentageString(vramStatus.free, vramStatus.total)}% ${chalk.gray("(" + bytes(vramStatus.free) + "/" + bytes(vramStatus.total) + ")")}`);
54+
console.info(`${chalk.yellow("Used VRAM:")} ${getPercentageString(vramStatus.used, vramStatus.total)}% ${chalk.gray("(" + toBytes(vramStatus.used) + "/" + toBytes(vramStatus.total) + ")")}`);
55+
console.info(`${chalk.yellow("Free VRAM:")} ${getPercentageString(vramStatus.free, vramStatus.total)}% ${chalk.gray("(" + toBytes(vramStatus.free) + "/" + toBytes(vramStatus.total) + ")")}`);
5656
console.info();
57-
console.info(`${chalk.yellow("Used RAM:")} ${getPercentageString(usedMemory, totalMemory)}% ${chalk.gray("(" + bytes(usedMemory) + "/" + bytes(totalMemory) + ")")}`);
58-
console.info(`${chalk.yellow("Free RAM:")} ${getPercentageString(freeMemory, totalMemory)}% ${chalk.gray("(" + bytes(freeMemory) + "/" + bytes(totalMemory) + ")")}`);
57+
console.info(`${chalk.yellow("Used RAM:")} ${getPercentageString(usedMemory, totalMemory)}% ${chalk.gray("(" + toBytes(usedMemory) + "/" + toBytes(totalMemory) + ")")}`);
58+
console.info(`${chalk.yellow("Free RAM:")} ${getPercentageString(freeMemory, totalMemory)}% ${chalk.gray("(" + toBytes(freeMemory) + "/" + toBytes(totalMemory) + ")")}`);
5959
}
6060

6161
async function DebugCmakeOptionsFunction() {

src/cli/commands/inspect/commands/InspectEstimateCommand.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {CommandModule} from "yargs";
22
import chalk from "chalk";
3-
import bytes from "bytes";
43
import {readGgufFileInfo} from "../../../../gguf/readGgufFileInfo.js";
54
import {resolveHeaderFlag} from "../../../utils/resolveHeaderFlag.js";
65
import {withCliCommandDescriptionDocsUrl} from "../../../utils/withCliCommandDescriptionDocsUrl.js";
@@ -20,6 +19,7 @@ import {getPrettyBuildGpuName} from "../../../../bindings/consts.js";
2019
import withOra from "../../../../utils/withOra.js";
2120
import {resolveModelDestination} from "../../../../utils/resolveModelDestination.js";
2221
import {printModelDestination} from "../../../utils/printModelDestination.js";
22+
import {toBytes} from "../../../utils/toBytes.js";
2323

2424
type InspectEstimateCommand = {
2525
modelPath: string,
@@ -198,7 +198,7 @@ export const InspectEstimateCommand: CommandModule<object, InspectEstimateComman
198198
value: getPrettyBuildGpuName(llama.gpu)
199199
}, {
200200
title: "VRAM",
201-
value: bytes(vramState.total)
201+
value: toBytes(vramState.total)
202202
}, {
203203
title: "Name",
204204
value: toOneLine(deviceNames.join(", "))
@@ -219,7 +219,7 @@ export const InspectEstimateCommand: CommandModule<object, InspectEstimateComman
219219
)
220220
}, {
221221
title: "Size",
222-
value: bytes(ggufInsights.modelSize)
222+
value: toBytes(ggufInsights.modelSize)
223223
}, {
224224
show: ggufInsights.trainContextSize != null,
225225
title: "Train context size",
@@ -262,10 +262,10 @@ function logCompatibilityScore(
262262
}, {
263263
show: llama.gpu !== false,
264264
title: "VRAM usage",
265-
value: () => bytes(compatibilityScore.resolvedValues.totalVramUsage)
265+
value: () => toBytes(compatibilityScore.resolvedValues.totalVramUsage)
266266
}, {
267267
title: "RAM usage",
268-
value: () => bytes(compatibilityScore.resolvedValues.totalRamUsage)
268+
value: () => toBytes(compatibilityScore.resolvedValues.totalRamUsage)
269269
}, {
270270
show: flashAttention,
271271
title: "Flash attention",

src/cli/commands/inspect/commands/InspectGgufCommand.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import path from "path";
22
import process from "process";
33
import {CommandModule} from "yargs";
44
import chalk from "chalk";
5-
import bytes from "bytes";
65
import fs from "fs-extra";
76
import {readGgufFileInfo} from "../../../../gguf/readGgufFileInfo.js";
87
import {prettyPrintObject, PrettyPrintObjectOptions} from "../../../../utils/prettyPrintObject.js";
@@ -15,6 +14,7 @@ import {resolveModelDestination} from "../../../../utils/resolveModelDestination
1514
import {printModelDestination} from "../../../utils/printModelDestination.js";
1615
import {getGgufMetadataKeyValue} from "../../../../gguf/utils/getGgufMetadataKeyValue.js";
1716
import {GgufTensorInfo} from "../../../../gguf/types/GgufTensorInfoTypes.js";
17+
import {toBytes} from "../../../utils/toBytes.js";
1818

1919
type InspectGgufCommand = {
2020
modelPath: string,
@@ -206,8 +206,8 @@ export const InspectGgufCommand: CommandModule<object, InspectGgufCommand> = {
206206

207207
console.info(`${chalk.yellow("GGUF version:")} ${parsedMetadata.version}`);
208208
console.info(`${chalk.yellow("Tensor count:")} ${parsedMetadata.totalTensorCount.toLocaleString("en-US", numberLocaleFormattingOptions)}`);
209-
console.info(`${chalk.yellow("Metadata size:")} ${bytes(parsedMetadata.totalMetadataSize)}`);
210-
console.info(`${chalk.yellow("Tensor info size:")} ${bytes(parsedMetadata.totalTensorInfoSize!)}`);
209+
console.info(`${chalk.yellow("Metadata size:")} ${toBytes(parsedMetadata.totalMetadataSize)}`);
210+
console.info(`${chalk.yellow("Tensor info size:")} ${toBytes(parsedMetadata.totalTensorInfoSize!)}`);
211211
console.info(`${chalk.yellow("File type:")} ${fileTypeName ?? ""} ${chalk.white(`(${parsedMetadata.metadata.general?.file_type})`)}`);
212212
console.info(`${chalk.yellow("Metadata:")} ${prettyPrintObject(parsedMetadata.metadata, undefined, metadataPrettyPrintOptions)}`);
213213
console.info(`${chalk.yellow("Tensor info:")} ${prettyPrintObject(parsedMetadata.fullTensorInfo, undefined, tensorInfoPrettyPrintOptions)}`);

src/cli/commands/inspect/commands/InspectGpuCommand.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os from "os";
22
import {CommandModule} from "yargs";
3-
import bytes from "bytes";
43
import chalk from "chalk";
54
import {getLlamaForOptions} from "../../../../bindings/getLlama.js";
65
import {detectAvailableComputeLayers} from "../../../../bindings/utils/detectAvailableComputeLayers.js";
@@ -14,6 +13,7 @@ import {Llama} from "../../../../bindings/Llama.js";
1413
import {getPlatformInfo} from "../../../../bindings/utils/getPlatformInfo.js";
1514
import {getLinuxDistroInfo} from "../../../../bindings/utils/getLinuxDistroInfo.js";
1615
import {isRunningUnderRosetta} from "../../../utils/isRunningUnderRosetta.js";
16+
import {toBytes} from "../../../utils/toBytes.js";
1717

1818
type InspectGpuCommand = {
1919
// no options for now
@@ -189,11 +189,11 @@ async function logGpuVramUsage(gpu: BuildGpu, llama: Llama) {
189189
if (gpuDeviceNames.length > 0)
190190
console.info(`${chalk.yellow(`${gpuName} device${gpuDeviceNames.length > 1 ? "s" : ""}:`)} ${gpuDeviceNames.join(", ")}`);
191191

192-
console.info(`${chalk.yellow(`${gpuName} used VRAM:`)} ${getPercentageString(vramState.used, vramState.total)}% ${chalk.gray("(" + bytes(vramState.used) + "/" + bytes(vramState.total) + ")")}`);
193-
console.info(`${chalk.yellow(`${gpuName} free VRAM:`)} ${getPercentageString(vramState.free, vramState.total)}% ${chalk.gray("(" + bytes(vramState.free) + "/" + bytes(vramState.total) + ")")}`);
192+
console.info(`${chalk.yellow(`${gpuName} used VRAM:`)} ${getPercentageString(vramState.used, vramState.total)}% ${chalk.gray("(" + toBytes(vramState.used) + "/" + toBytes(vramState.total) + ")")}`);
193+
console.info(`${chalk.yellow(`${gpuName} free VRAM:`)} ${getPercentageString(vramState.free, vramState.total)}% ${chalk.gray("(" + toBytes(vramState.free) + "/" + toBytes(vramState.total) + ")")}`);
194194

195195
if (vramState.unifiedSize > 0)
196-
console.info(`${chalk.yellow(`${gpuName} unified memory:`)} ${bytes(vramState.unifiedSize)} ${chalk.gray("(" + getPercentageString(vramState.unifiedSize, vramState.total) + "%)")}`);
196+
console.info(`${chalk.yellow(`${gpuName} unified memory:`)} ${toBytes(vramState.unifiedSize)} ${chalk.gray("(" + getPercentageString(vramState.unifiedSize, vramState.total) + "%)")}`);
197197
} catch (err) {}
198198
}
199199

@@ -215,15 +215,15 @@ async function logRamUsage(cpuMathCores?: number) {
215215
if (cpuMathCores != null)
216216
console.info(`${chalk.yellow("Math cores:")} ${cpuMathCores}`);
217217

218-
console.info(`${chalk.yellow("Used RAM:")} ${getPercentageString(usedMemory, totalMemory)}% ${chalk.gray("(" + bytes(usedMemory) + "/" + bytes(totalMemory) + ")")}`);
219-
console.info(`${chalk.yellow("Free RAM:")} ${getPercentageString(freeMemory, totalMemory)}% ${chalk.gray("(" + bytes(freeMemory) + "/" + bytes(totalMemory) + ")")}`);
218+
console.info(`${chalk.yellow("Used RAM:")} ${getPercentageString(usedMemory, totalMemory)}% ${chalk.gray("(" + toBytes(usedMemory) + "/" + toBytes(totalMemory) + ")")}`);
219+
console.info(`${chalk.yellow("Free RAM:")} ${getPercentageString(freeMemory, totalMemory)}% ${chalk.gray("(" + toBytes(freeMemory) + "/" + toBytes(totalMemory) + ")")}`);
220220
}
221221

222222
async function logSwapUsage(llama: Llama) {
223223
const swapState = await llama.getSwapState();
224224

225-
console.info(`${chalk.yellow("Used swap:")} ${getPercentageString(swapState.used, swapState.allocated)}% ${chalk.gray("(" + bytes(swapState.used) + "/" + bytes(swapState.allocated) + ")")}`);
226-
console.info(`${chalk.yellow("Max swap size:")} ${swapState.maxSize === Infinity ? "dynamic" : bytes(swapState.maxSize)}`);
225+
console.info(`${chalk.yellow("Used swap:")} ${getPercentageString(swapState.used, swapState.allocated)}% ${chalk.gray("(" + toBytes(swapState.used) + "/" + toBytes(swapState.allocated) + ")")}`);
226+
console.info(`${chalk.yellow("Max swap size:")} ${swapState.maxSize === Infinity ? "dynamic" : toBytes(swapState.maxSize)}`);
227227
}
228228

229229
function getPercentageString(amount: number, total: number) {

src/cli/commands/inspect/commands/InspectMeasureCommand.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {fork} from "node:child_process";
55
import os from "os";
66
import {CommandModule} from "yargs";
77
import chalk from "chalk";
8-
import bytes from "bytes";
98
import stripAnsi from "strip-ansi";
109
import {readGgufFileInfo} from "../../../../gguf/readGgufFileInfo.js";
1110
import {resolveCommandGgufPath} from "../../../utils/resolveCommandGgufPath.js";
@@ -21,6 +20,7 @@ import {getReadablePath} from "../../../utils/getReadablePath.js";
2120
import {withCliCommandDescriptionDocsUrl} from "../../../utils/withCliCommandDescriptionDocsUrl.js";
2221
import {documentationPageUrls} from "../../../../config.js";
2322
import {Llama} from "../../../../bindings/Llama.js";
23+
import {toBytes} from "../../../utils/toBytes.js";
2424

2525
type InspectMeasureCommand = {
2626
modelPath?: string,
@@ -271,13 +271,13 @@ export const InspectMeasureCommand: CommandModule<object, InspectMeasureCommand>
271271
});
272272
const modelVramEstimation = modelResourceEstimation.gpuVram;
273273
const modelVramEstimationDiffBytes = (modelVramEstimation < result.modelVramUsage ? "-" : "") +
274-
bytes(Math.abs(result.modelVramUsage - modelVramEstimation));
274+
toBytes(Math.abs(result.modelVramUsage - modelVramEstimation));
275275
const modelVramEstimationDiffText = modelVramEstimationDiffBytes.padEnd(9, " ") + " " +
276276
padStartAnsi("(" + renderDiffPercentageWithColors(((modelVramEstimation / result.modelVramUsage) - 1) * 100) + ")", 9);
277277

278278
const modelRamEstimation = modelResourceEstimation.cpuRam;
279279
const modelRamEstimationDiffBytes = (modelRamEstimation < result.modelRamUsage ? "-" : "") +
280-
bytes(Math.abs(result.modelRamUsage - modelRamEstimation));
280+
toBytes(Math.abs(result.modelRamUsage - modelRamEstimation));
281281
const modelRamEstimationDiffText = modelRamEstimationDiffBytes.padEnd(9, " ") + " " +
282282
padStartAnsi("(" + renderDiffPercentageWithColors(((modelRamEstimation / result.modelRamUsage) - 1) * 100) + ")", 9);
283283

@@ -294,7 +294,7 @@ export const InspectMeasureCommand: CommandModule<object, InspectMeasureCommand>
294294
? undefined
295295
: (
296296
(contextVramEstimation < result.contextVramUsage ? "-" : "") +
297-
bytes(Math.abs(result.contextVramUsage - contextVramEstimation))
297+
toBytes(Math.abs(result.contextVramUsage - contextVramEstimation))
298298
);
299299
const contextVramEstimationDiffText = (
300300
contextVramEstimation == null || contextVramEstimationDiffBytes == null || result.contextVramUsage == null
@@ -310,7 +310,7 @@ export const InspectMeasureCommand: CommandModule<object, InspectMeasureCommand>
310310
? undefined
311311
: (
312312
(contextRamEstimation < result.contextRamUsage ? "-" : "") +
313-
bytes(Math.abs(result.contextRamUsage - contextRamEstimation))
313+
toBytes(Math.abs(result.contextRamUsage - contextRamEstimation))
314314
);
315315
const contextRamEstimationDiffText = (
316316
contextRamEstimation == null || contextRamEstimationDiffBytes == null || result.contextRamUsage == null
@@ -331,33 +331,33 @@ export const InspectMeasureCommand: CommandModule<object, InspectMeasureCommand>
331331
? String(previousContextSizeCheck)
332332
: undefined,
333333

334-
estimatedModelVram: bytes(modelVramEstimation),
335-
actualModelVram: bytes(result.modelVramUsage),
334+
estimatedModelVram: toBytes(modelVramEstimation),
335+
actualModelVram: toBytes(result.modelVramUsage),
336336
modelVramEstimationDiff: modelVramEstimationDiffText,
337337

338-
estimatedModelRam: bytes(modelRamEstimation),
339-
actualModelRam: bytes(result.modelRamUsage),
338+
estimatedModelRam: toBytes(modelRamEstimation),
339+
actualModelRam: toBytes(result.modelRamUsage),
340340
modelRamEstimationDiff: modelRamEstimationDiffText,
341341

342342
estimatedContextVram: contextVramEstimation == null
343343
? undefined
344-
: bytes(contextVramEstimation),
344+
: toBytes(contextVramEstimation),
345345
actualContextVram: result.contextVramUsage == null
346346
? undefined
347-
: bytes(result.contextVramUsage),
347+
: toBytes(result.contextVramUsage),
348348
contextVramEstimationDiff: contextVramEstimationDiffText,
349349
totalVramUsage: ((result.totalVramUsage / totalVram) * 100).toFixed(2).padStart(5, "0") + "% " +
350-
chalk.gray("(" + bytes(result.totalVramUsage) + "/" + bytes(totalVram) + ")"),
350+
chalk.gray("(" + toBytes(result.totalVramUsage) + "/" + toBytes(totalVram) + ")"),
351351

352352
estimatedContextRam: contextRamEstimation == null
353353
? undefined
354-
: bytes(contextRamEstimation),
354+
: toBytes(contextRamEstimation),
355355
actualContextRam: result.contextRamUsage == null
356356
? undefined
357-
: bytes(result.contextRamUsage),
357+
: toBytes(result.contextRamUsage),
358358
contextRamEstimationDiff: contextRamEstimationDiffText,
359359
totalRamUsage: ((result.totalRamUsage / totalRam) * 100).toFixed(2).padStart(5, "0") + "% " +
360-
chalk.gray("(" + bytes(result.totalRamUsage) + "/" + bytes(totalRam) + ")")
360+
chalk.gray("(" + toBytes(result.totalRamUsage) + "/" + toBytes(totalRam) + ")")
361361
});
362362
}
363363
}

0 commit comments

Comments
 (0)