omnius 1.0.105 → 1.0.106
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/dist/index.js +74 -21
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -578020,10 +578020,43 @@ async function needsTextToolMode(modelName, backendUrl2) {
|
|
|
578020
578020
|
const hasTools = await checkToolSupport(modelName, backendUrl2);
|
|
578021
578021
|
return !hasTools;
|
|
578022
578022
|
}
|
|
578023
|
+
function parseNvidiaSmi(stdout) {
|
|
578024
|
+
let total = 0;
|
|
578025
|
+
let free = 0;
|
|
578026
|
+
let name10 = "";
|
|
578027
|
+
const lines = stdout.trim().split("\n").filter(Boolean);
|
|
578028
|
+
for (const line of lines) {
|
|
578029
|
+
const parts = line.split(",").map((s2) => s2.trim());
|
|
578030
|
+
const totMB = parseInt(parts[0] ?? "0", 10);
|
|
578031
|
+
const freeMB = parseInt(parts[1] ?? "0", 10);
|
|
578032
|
+
if (!isNaN(totMB)) total += totMB / 1024;
|
|
578033
|
+
if (!isNaN(freeMB)) free += freeMB / 1024;
|
|
578034
|
+
if (!name10 && parts[2]) name10 = parts[2];
|
|
578035
|
+
}
|
|
578036
|
+
return { total, free, name: name10 };
|
|
578037
|
+
}
|
|
578038
|
+
function parseRocmSmi(stdout) {
|
|
578039
|
+
let total = 0;
|
|
578040
|
+
let used = 0;
|
|
578041
|
+
let name10 = "";
|
|
578042
|
+
const lines = stdout.trim().split("\n").filter(Boolean);
|
|
578043
|
+
for (const line of lines) {
|
|
578044
|
+
if (line.toLowerCase().startsWith("device") || line.startsWith("=")) continue;
|
|
578045
|
+
const parts = line.split(",").map((s2) => s2.trim());
|
|
578046
|
+
if (parts.length < 3) continue;
|
|
578047
|
+
const usedBytes = parseInt(parts[1] ?? "0", 10);
|
|
578048
|
+
const totBytes = parseInt(parts[2] ?? "0", 10);
|
|
578049
|
+
if (!isNaN(usedBytes)) used += usedBytes / 1024 ** 3;
|
|
578050
|
+
if (!isNaN(totBytes)) total += totBytes / 1024 ** 3;
|
|
578051
|
+
if (!name10 && parts[0]) name10 = parts[0];
|
|
578052
|
+
}
|
|
578053
|
+
return { total, free: Math.max(0, total - used), name: name10 ? `AMD ${name10}` : "AMD GPU" };
|
|
578054
|
+
}
|
|
578023
578055
|
function detectSystemSpecs() {
|
|
578024
578056
|
let totalRamGB = 0;
|
|
578025
578057
|
let availableRamGB = 0;
|
|
578026
578058
|
let gpuVramGB = 0;
|
|
578059
|
+
let availableVramGB = 0;
|
|
578027
578060
|
let gpuName = "";
|
|
578028
578061
|
try {
|
|
578029
578062
|
const memInfo = execSync50("free -b 2>/dev/null || sysctl -n hw.memsize 2>/dev/null", {
|
|
@@ -578047,24 +578080,33 @@ function detectSystemSpecs() {
|
|
|
578047
578080
|
}
|
|
578048
578081
|
try {
|
|
578049
578082
|
const nvidiaSmi = execSync50(
|
|
578050
|
-
"nvidia-smi --query-gpu=memory.total,name --format=csv,noheader,nounits 2>/dev/null",
|
|
578083
|
+
"nvidia-smi --query-gpu=memory.total,memory.free,name --format=csv,noheader,nounits 2>/dev/null",
|
|
578051
578084
|
{ encoding: "utf8", timeout: 5e3 }
|
|
578052
578085
|
);
|
|
578053
|
-
const
|
|
578054
|
-
|
|
578055
|
-
|
|
578056
|
-
|
|
578057
|
-
const vramMB = parseInt(parts[0] ?? "0", 10);
|
|
578058
|
-
if (!isNaN(vramMB)) gpuVramGB += vramMB / 1024;
|
|
578059
|
-
if (!gpuName && parts[1]) gpuName = parts[1];
|
|
578060
|
-
}
|
|
578061
|
-
}
|
|
578086
|
+
const r2 = parseNvidiaSmi(nvidiaSmi);
|
|
578087
|
+
gpuVramGB += r2.total;
|
|
578088
|
+
availableVramGB += r2.free;
|
|
578089
|
+
if (!gpuName && r2.name) gpuName = r2.name;
|
|
578062
578090
|
} catch {
|
|
578063
578091
|
}
|
|
578092
|
+
if (gpuVramGB === 0) {
|
|
578093
|
+
try {
|
|
578094
|
+
const rocmSmi = execSync50(
|
|
578095
|
+
"rocm-smi --showmeminfo vram --csv 2>/dev/null",
|
|
578096
|
+
{ encoding: "utf8", timeout: 5e3 }
|
|
578097
|
+
);
|
|
578098
|
+
const r2 = parseRocmSmi(rocmSmi);
|
|
578099
|
+
gpuVramGB += r2.total;
|
|
578100
|
+
availableVramGB += r2.free;
|
|
578101
|
+
if (!gpuName && r2.name) gpuName = r2.name;
|
|
578102
|
+
} catch {
|
|
578103
|
+
}
|
|
578104
|
+
}
|
|
578064
578105
|
return {
|
|
578065
578106
|
totalRamGB: Math.round(totalRamGB * 10) / 10,
|
|
578066
578107
|
availableRamGB: Math.round(availableRamGB * 10) / 10,
|
|
578067
578108
|
gpuVramGB: Math.round(gpuVramGB * 10) / 10,
|
|
578109
|
+
availableVramGB: Math.round(availableVramGB * 10) / 10,
|
|
578068
578110
|
gpuName
|
|
578069
578111
|
};
|
|
578070
578112
|
}
|
|
@@ -578072,6 +578114,7 @@ async function detectSystemSpecsAsync() {
|
|
|
578072
578114
|
let totalRamGB = 0;
|
|
578073
578115
|
let availableRamGB = 0;
|
|
578074
578116
|
let gpuVramGB = 0;
|
|
578117
|
+
let availableVramGB = 0;
|
|
578075
578118
|
let gpuName = "";
|
|
578076
578119
|
try {
|
|
578077
578120
|
const { stdout: memInfo } = await execAsync2(
|
|
@@ -578095,24 +578138,33 @@ async function detectSystemSpecsAsync() {
|
|
|
578095
578138
|
}
|
|
578096
578139
|
try {
|
|
578097
578140
|
const { stdout: nvidiaSmi } = await execAsync2(
|
|
578098
|
-
"nvidia-smi --query-gpu=memory.total,name --format=csv,noheader,nounits 2>/dev/null",
|
|
578141
|
+
"nvidia-smi --query-gpu=memory.total,memory.free,name --format=csv,noheader,nounits 2>/dev/null",
|
|
578099
578142
|
{ timeout: 5e3 }
|
|
578100
578143
|
);
|
|
578101
|
-
const
|
|
578102
|
-
|
|
578103
|
-
|
|
578104
|
-
|
|
578105
|
-
const vramMB = parseInt(parts[0] ?? "0", 10);
|
|
578106
|
-
if (!isNaN(vramMB)) gpuVramGB += vramMB / 1024;
|
|
578107
|
-
if (!gpuName && parts[1]) gpuName = parts[1];
|
|
578108
|
-
}
|
|
578109
|
-
}
|
|
578144
|
+
const r2 = parseNvidiaSmi(nvidiaSmi);
|
|
578145
|
+
gpuVramGB += r2.total;
|
|
578146
|
+
availableVramGB += r2.free;
|
|
578147
|
+
if (!gpuName && r2.name) gpuName = r2.name;
|
|
578110
578148
|
} catch {
|
|
578111
578149
|
}
|
|
578150
|
+
if (gpuVramGB === 0) {
|
|
578151
|
+
try {
|
|
578152
|
+
const { stdout: rocmSmi } = await execAsync2(
|
|
578153
|
+
"rocm-smi --showmeminfo vram --csv 2>/dev/null",
|
|
578154
|
+
{ timeout: 5e3 }
|
|
578155
|
+
);
|
|
578156
|
+
const r2 = parseRocmSmi(rocmSmi);
|
|
578157
|
+
gpuVramGB += r2.total;
|
|
578158
|
+
availableVramGB += r2.free;
|
|
578159
|
+
if (!gpuName && r2.name) gpuName = r2.name;
|
|
578160
|
+
} catch {
|
|
578161
|
+
}
|
|
578162
|
+
}
|
|
578112
578163
|
return {
|
|
578113
578164
|
totalRamGB: Math.round(totalRamGB * 10) / 10,
|
|
578114
578165
|
availableRamGB: Math.round(availableRamGB * 10) / 10,
|
|
578115
578166
|
gpuVramGB: Math.round(gpuVramGB * 10) / 10,
|
|
578167
|
+
availableVramGB: Math.round(availableVramGB * 10) / 10,
|
|
578116
578168
|
gpuName
|
|
578117
578169
|
};
|
|
578118
578170
|
}
|
|
@@ -578129,7 +578181,8 @@ function recommendModel(specs) {
|
|
|
578129
578181
|
}
|
|
578130
578182
|
function calculateContextWindow(specs, modelSizeGB2, kvBytesPerToken, archMax) {
|
|
578131
578183
|
const ramBudget = specs.availableRamGB > 0 ? specs.availableRamGB : specs.totalRamGB;
|
|
578132
|
-
const
|
|
578184
|
+
const vramBudget = specs.availableVramGB > 0 ? specs.availableVramGB : specs.gpuVramGB;
|
|
578185
|
+
const totalAvail = Math.max(vramBudget, ramBudget);
|
|
578133
578186
|
const remaining = Math.max(0, totalAvail - modelSizeGB2);
|
|
578134
578187
|
const usableGB = remaining * 0.85;
|
|
578135
578188
|
let numCtx;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.106",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.106",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED