odant-work 1.0.31 → 1.0.32
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/#system/package-manifest.json +10 -10
- package/MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js +1 -1
- package/package.json +1 -1
- package/sources/data/progress.md +3 -0
- package/sources/modules/trainer/halogen.js +190 -48
- package/sources/modules/trainer/huggingface.js +104 -19
- package/sources/modules/trainer/index.js +18 -4
- package/sources/modules/trainer/runner.js +7 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "odant-work",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
4
4
|
"createdAt": 1794658837090,
|
|
5
|
-
"updatedAt":
|
|
5
|
+
"updatedAt": 1794843970811,
|
|
6
6
|
"files": {
|
|
7
7
|
"run.mjs": "f8918c612e8641e9beee06221be6680aa6fd21f25468451f2ac857fd51772266",
|
|
8
|
-
"package.json": "
|
|
9
|
-
"package-lock.json": "
|
|
8
|
+
"package.json": "9ce7d310e1952228bc7656508aeba46b812e3f1cc30f19909ad5141857ff73e4",
|
|
9
|
+
"package-lock.json": "42b9862328614fbef54e6f7158dd4cb836e96006f0272eb722db399aff0f6767",
|
|
10
10
|
"sources/client/class.js": "c3fb8f143fc83aaa2df1ddeddd412d2d4dfe88656578095babe2df34fb3b3922",
|
|
11
11
|
"sources/client/field.js": "ffdd50fa8b6ec515cc42da5fca96658ff2b20e274601a1f926e0031372467a19",
|
|
12
12
|
"sources/client/file.js": "667101d75fa30840370d5be232e518aaac7c1fd52ca05a12da560eef6c0848b0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"sources/data/objects.js": "23f51d5b00cd766fe27879b874738bc9bd9056bd6e27285fb7a52926c0dbc6a8",
|
|
27
27
|
"sources/data/posting.js": "6595bb9ec632539ae7629504db327d25a491e61c1cdc598bb43d08ea0d45548d",
|
|
28
28
|
"sources/data/print.js": "704f0f2fc80c6466a4196e4650d763150cf9b592eab14ea67ece85d51100107c",
|
|
29
|
-
"sources/data/progress.md": "
|
|
29
|
+
"sources/data/progress.md": "c36ef70aac8a0d9c6ed03f7664e9d0148be7eba014ccae27f646a2600ac888d1",
|
|
30
30
|
"sources/data/readme.md": "593fa2ae07aa91bc26d7542275da6953a9cd419240a9a49e00cb62fb9d5d8e36",
|
|
31
31
|
"sources/data/reports.js": "0330f404860fe2589a7d46a2f0fe690ca23249bd841a062a26718742d4fd11d6",
|
|
32
32
|
"sources/data/schema.js": "1c994f9adb76c156dc86601dd6b1046376b66549b041e1a58aa1727b5476bdbe",
|
|
@@ -176,13 +176,13 @@
|
|
|
176
176
|
"sources/modules/sandbox/vnc-proxy.js": "1c75c2b24d579f254de1c4727621fbbcc7e8a10360f638f4cf1c4bd91184d103",
|
|
177
177
|
"sources/modules/trainer/dataset.js": "e631e1feda2958cf93436cb48a331958d7b029aa52bd42247865e87504b642f7",
|
|
178
178
|
"sources/modules/trainer/downloader.js": "d9e96cb07e7bf64386558be8c2265c482af35a513f42954250add6d5fc87bdc4",
|
|
179
|
-
"sources/modules/trainer/halogen.js": "
|
|
180
|
-
"sources/modules/trainer/huggingface.js": "
|
|
181
|
-
"sources/modules/trainer/index.js": "
|
|
179
|
+
"sources/modules/trainer/halogen.js": "8b82459a7fadc92f81a748e18930a5077d124da40616665b8136b9ac5d138f62",
|
|
180
|
+
"sources/modules/trainer/huggingface.js": "1f866a81c2c0640c0cc5abda651df50c2412f4b0ef586d0e7a9324360e22e745",
|
|
181
|
+
"sources/modules/trainer/index.js": "5363df8051b48293e3b6355ff5a5da903767da42297a4aca6b5026b449e08e5b",
|
|
182
182
|
"sources/modules/trainer/local-engine.js": "0aa161d9800be79534e8fcb8271c418a5e342d29244c95cd448e7df6d6b15458",
|
|
183
183
|
"sources/modules/trainer/paths.js": "92b7dca6e3c86872f12d7738501c4c706918ea97d202371412944bf38f4c1479",
|
|
184
184
|
"sources/modules/trainer/providers.js": "c842cc928b846559776170d1f49e67748c2ada0db40a29cbf911d70197bc07c8",
|
|
185
|
-
"sources/modules/trainer/runner.js": "
|
|
185
|
+
"sources/modules/trainer/runner.js": "cc089953d7164a6fa4f996f5b1647edfc39ee0c70ff864fa35ef5bcf69cfcf63",
|
|
186
186
|
"sources/modules/trainer/tar-stream.js": "52f1739579a01818b53d04a93fd05a91c49a0716019f309a6fca951ba112794f",
|
|
187
187
|
"sources/modules/trainer/transfer.js": "2c603d538e0f85e1794e2f304081fac136f0ff72f85d8b00c2141c7402b3a1fb",
|
|
188
188
|
"sources/modules/trainer/worker/local_infer_worker.py": "7b001d75c64ac3ae6de650f6d738f22bfc21b6bd0694b57248e5b40966deb443",
|
|
@@ -982,7 +982,7 @@
|
|
|
982
982
|
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/provider/$handler/class.js": "8d327820cefd696d351ac4fa7998994039e4d57ef7a9f8ae297209e4dd1b0a9e",
|
|
983
983
|
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/provider/$handler/provider.js": "b9ddf0040a9cd12e0dacd2dd3a61a1f0e62686cc664d02ef446326bc3991f4ce",
|
|
984
984
|
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/class.js": "06b279a1c053deb37dd7401c84df7f9370309b8dfbd35b368ab1bab4f635cb3f",
|
|
985
|
-
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js": "
|
|
985
|
+
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js": "4164d177cd978c75fd2163f30a99e6eff9566b9a59d595883bf3a54469099b77",
|
|
986
986
|
"MODELS/$ai/$folder/$class/$provider/readme.md": "d6ceef2010231ab121510c3d3f35630dd7009a069c7723f6673a0e264799b227",
|
|
987
987
|
"MODELS/$ai/class.js": "54e1bbbde88f8b1f272ff7f5cad87243407591748a44719b7ec90ae2b4962de7",
|
|
988
988
|
"MODELS/$ai/readme.md": "90d70305a2c85312282cf67cc468a0f0b417495cb3d5b3d2ca60c6f44b81cb77",
|
|
@@ -882,7 +882,7 @@ export default {
|
|
|
882
882
|
if (findEntry(h.nodeName, h.hfRepo))
|
|
883
883
|
continue;
|
|
884
884
|
const dl = h.activeDownload || null;
|
|
885
|
-
const state = dl?.status === 'downloading' ? 'downloading' : 'available';
|
|
885
|
+
const state = dl?.status === 'downloading' ? 'downloading' : (dl?.status === 'failed' ? 'failed' : 'available');
|
|
886
886
|
const progressPct = dl ? Math.min(99, Math.max(1, Number(dl.progress) || 5)) : 0;
|
|
887
887
|
list.push({
|
|
888
888
|
key: `halo:${h.nodeName}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odant-work",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
4
4
|
"description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "sources/work.js",
|
package/sources/data/progress.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Прогресс: sources/data
|
|
2
2
|
|
|
3
3
|
## Последние изменения
|
|
4
|
+
- [18:05, 16.11] Единый 8-поточный загрузчик WORK для `Qwen3.8-Flash-Next` на Windows (108.6 GiB GGUF + Bubo финализация) и исправление распаковки архива `bubo.exe` (`sources/modules/trainer/{halogen,huggingface,index,runner}.js`, `MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js`, `tests/halogen-provider.test.js`, `odant-work@1.0.32`):
|
|
5
|
+
- **Устранена причина остановки на «Распаковка архива Bubo»:** в `bubo-v0.1.2-windows-x64-gfx1151.zip` файлы лежат во вложенной папке `bubo-v0.1.2-windows-x64-gfx1151/bin/bubo.exe`, из-за чего `Expand-Archive` клал `bubo.exe` на уровень глубже и последующие шаги пропускались. Теперь распаковка идёт через `AdmZip` со снятием общего верхнего каталога прямо в `#runtime/bubo/bin/bubo.exe`, а `inspectWindowsHalogenEnvironment` ищет также во вложенных подпапках.
|
|
6
|
+
- **Штатная многопоточная загрузка `Qwen3.8-Flash-Next` на Windows (`BUBO_ORIGINAL_MODEL_FILES`, `customFiles` + `customFilesDir`):** вместо слепого вызова внешнего процесса `bubo.exe` все 8 файлов модели (4 шарда `UD-Q4_K_XL` + `MTP` + `mmproj` + `twin` + `draft_head`) скачиваются тем же многопоточным загрузчиком WORK (8 потоков, зеркала `hf-mirror.com`, прокси, МБ/с, ETA, Пауза/Докачка/Сброс), после чего `finalizeWindowsBuboModel` разворачивает `bubo` + `ROCm 10.0.0` и генерирует `bubo-package.json` через `bubo prepare model --offline`.
|
|
4
7
|
- [17:15, 16.11] Быстрый расчёт `RAM + UMA` через реестр Windows (192 ГБ на Ryzen AI Max+ PRO 495), полный комплект из 8 Windows-совместимых моделей Halo и загрузка без блокировок (`sources/modules/trainer/{runner,halogen,huggingface,paths,providers,index}.js`, `MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js`, `tests/halogen-provider.test.js`, `odant-work@1.0.31`):
|
|
5
8
|
- **Мгновенный опрос видеопамяти/UMA на Windows (`detectHardware` + `parseWindowsVideoRegistry`):** вместо медленного PowerShell/WMI (который мог падать по таймауту 4.5 с и занижать 192 ГБ машинку Halo до `63.7 ГБ`) используется нативный `reg query` (~50 мс) с чтением `DriverDesc` и 64-битного `HardwareInformation.qwMemorySize` (`REG_QWORD` и `REG_BINARY`). Для Unified APU (`64 ГБ CPU + 128 ГБ GPU`) суммарная память определяется как **~192 ГБ**.
|
|
6
9
|
- **Полный комплект из 8 моделей Halo на Windows (`HALOGEN_WINDOWS_COMPANIONS`):** вместо исключённых Linux-only `.hnpw` моделей на Windows возвращены все 7 ролей-компаньонов в совместимом формате `.safetensors` (`Qwen3-4B` для сжатия, `Qwen3-ASR-1.7B` STT, `Qwen3-TTS-12Hz-1.7B-VoiceDesign` TTS, `Z-Image-Turbo` для картинок, `bge-m3` и `bge-reranker-v2-m3` для RAG, `Qwen3-0.6B` для быстрых классификаций) рядом с главной `Qwen3.8-Flash-Next` (Halowin Bubo GGUF).
|
|
@@ -34,6 +34,7 @@ import http from 'node:http';
|
|
|
34
34
|
import https from 'node:https';
|
|
35
35
|
import crypto from 'node:crypto';
|
|
36
36
|
import { spawn } from 'node:child_process';
|
|
37
|
+
import AdmZip from 'adm-zip';
|
|
37
38
|
import { startHuggingFaceDownload, listHuggingFaceDownloads, registerLocalModelNode } from './huggingface.js';
|
|
38
39
|
import { loadTrainerNetworkSettings, createNetworkFetch, downloadFileMultipart } from './downloader.js';
|
|
39
40
|
import {
|
|
@@ -68,6 +69,62 @@ export const BUBO_WINDOWS_RELEASE = Object.freeze({
|
|
|
68
69
|
vcRedistUrl: 'https://aka.ms/vs/17/release/vc_redist.x64.exe',
|
|
69
70
|
});
|
|
70
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Точные 8 файлов пакета `qwen38-flash-next-base-ud-q4-k-xl-v1` (108.608 GiB / 116.6 ГБ)
|
|
74
|
+
* для скачивания штатным многопоточным загрузчиком WORK и финализации через `bubo.exe prepare model --offline`.
|
|
75
|
+
*/
|
|
76
|
+
export const BUBO_ORIGINAL_MODEL_DIR_REL = 'MODELS/Local/models/qwen38-flash-next-base-ud-q4-k-xl-v1';
|
|
77
|
+
export const BUBO_ORIGINAL_MODEL_FILES = Object.freeze([
|
|
78
|
+
{
|
|
79
|
+
name: 'UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf',
|
|
80
|
+
destRelPath: 'Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf',
|
|
81
|
+
url: 'https://huggingface.co/unsloth/Qwen3.8-Flash-Next-GGUF/resolve/766911a6b7369840a91dbcd95f9f997acaab6cd6/UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf',
|
|
82
|
+
size: 10946624,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00002-of-00004.gguf',
|
|
86
|
+
destRelPath: 'Qwen3.8-Flash-Next-UD-Q4_K_XL-00002-of-00004.gguf',
|
|
87
|
+
url: 'https://huggingface.co/unsloth/Qwen3.8-Flash-Next-GGUF/resolve/766911a6b7369840a91dbcd95f9f997acaab6cd6/UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00002-of-00004.gguf',
|
|
88
|
+
size: 49859583136,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00003-of-00004.gguf',
|
|
92
|
+
destRelPath: 'Qwen3.8-Flash-Next-UD-Q4_K_XL-00003-of-00004.gguf',
|
|
93
|
+
url: 'https://huggingface.co/unsloth/Qwen3.8-Flash-Next-GGUF/resolve/766911a6b7369840a91dbcd95f9f997acaab6cd6/UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00003-of-00004.gguf',
|
|
94
|
+
size: 49376141504,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00004-of-00004.gguf',
|
|
98
|
+
destRelPath: 'Qwen3.8-Flash-Next-UD-Q4_K_XL-00004-of-00004.gguf',
|
|
99
|
+
url: 'https://huggingface.co/unsloth/Qwen3.8-Flash-Next-GGUF/resolve/766911a6b7369840a91dbcd95f9f997acaab6cd6/UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00004-of-00004.gguf',
|
|
100
|
+
size: 12087983520,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'mtp/mtp-Qwen3.8-Flash-Next-shared-Q8_0.gguf',
|
|
104
|
+
destRelPath: 'mtp/mtp-Qwen3.8-Flash-Next-shared-Q8_0.gguf',
|
|
105
|
+
url: 'https://huggingface.co/unsloth/Qwen3.8-Flash-Next-GGUF/resolve/766911a6b7369840a91dbcd95f9f997acaab6cd6/MTP/mtp-Qwen3.8-Flash-Next-shared-Q8_0.gguf',
|
|
106
|
+
size: 2786568256,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'mmproj/mmproj-Qwen3.8-Flash-Next-BF16.gguf',
|
|
110
|
+
destRelPath: 'mmproj/mmproj-Qwen3.8-Flash-Next-BF16.gguf',
|
|
111
|
+
url: 'https://huggingface.co/unsloth/Qwen3.8-Flash-Next-GGUF/resolve/766911a6b7369840a91dbcd95f9f997acaab6cd6/mmproj-BF16.gguf',
|
|
112
|
+
size: 907542944,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'twin/iq4-nofullattn-nohc.gguf',
|
|
116
|
+
destRelPath: 'twin/iq4-nofullattn-nohc.gguf',
|
|
117
|
+
url: 'https://huggingface.co/HaloForgeLabs/bubo-qwen3.8-flash-next/resolve/0a3c343bec2095f43f2906371c83e4faa8a47da1/twin-base/iq4-nofullattn-nohc.gguf',
|
|
118
|
+
size: 1230788768,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'draft_head/draft-out-q4k.gguf',
|
|
122
|
+
destRelPath: 'draft_head/draft-out-q4k.gguf',
|
|
123
|
+
url: 'https://huggingface.co/HaloForgeLabs/bubo-qwen3.8-flash-next/resolve/0a3c343bec2095f43f2906371c83e4faa8a47da1/draft_head/draft-out-q4k.gguf',
|
|
124
|
+
size: 357581248,
|
|
125
|
+
},
|
|
126
|
+
]);
|
|
127
|
+
|
|
71
128
|
/**
|
|
72
129
|
* Каталог штатных моделей для машинок Halo в `/MODELS/Local` (1 основная GPU-модель + 7 NPU-моделей на одном порту 8731).
|
|
73
130
|
*/
|
|
@@ -708,9 +765,25 @@ export function inspectWindowsHalogenEnvironment({ rootDir = process.cwd() } = {
|
|
|
708
765
|
const systemRoot = process.env.SystemRoot || 'C:\\Windows';
|
|
709
766
|
const rtBase = localRuntimeDir(rootDir);
|
|
710
767
|
|
|
768
|
+
const nestedBuboCandidates = [];
|
|
769
|
+
for (const parentDir of [path.join(rtBase, 'bubo'), path.join(rootDir, 'MODELS', 'Local', '#runtime', 'bubo')]) {
|
|
770
|
+
try {
|
|
771
|
+
if (fs.existsSync(parentDir)) {
|
|
772
|
+
for (const sub of fs.readdirSync(parentDir, { withFileTypes: true })) {
|
|
773
|
+
if (sub.isDirectory()) {
|
|
774
|
+
nestedBuboCandidates.push(path.join(parentDir, sub.name, 'bin', 'bubo.exe'));
|
|
775
|
+
nestedBuboCandidates.push(path.join(parentDir, sub.name, 'bubo.exe'));
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
catch { /* ignore */ }
|
|
781
|
+
}
|
|
782
|
+
|
|
711
783
|
const buboCandidates = [
|
|
712
784
|
path.join(rtBase, 'bubo', 'bin', 'bubo.exe'),
|
|
713
785
|
path.join(rtBase, 'bubo', 'bubo.exe'),
|
|
786
|
+
...nestedBuboCandidates,
|
|
714
787
|
path.join(rootDir, 'MODELS', 'Local', '#runtime', 'bubo', 'bin', 'bubo.exe'),
|
|
715
788
|
path.join(rootDir, 'MODELS', 'Local', '#runtime', 'bubo', 'bubo.exe'),
|
|
716
789
|
path.join(rootDir, 'MODELS', 'Halogen', '#runtime', 'bubo', 'bin', 'bubo.exe'),
|
|
@@ -1042,6 +1115,7 @@ export async function prepareWindowsBuboRuntime({
|
|
|
1042
1115
|
rootDir = process.cwd(),
|
|
1043
1116
|
step = 'runtime',
|
|
1044
1117
|
modelSet = 'original',
|
|
1118
|
+
offline = false,
|
|
1045
1119
|
fetchImpl = globalThis.fetch,
|
|
1046
1120
|
spawnImpl = spawn,
|
|
1047
1121
|
} = {}) {
|
|
@@ -1149,20 +1223,40 @@ export async function prepareWindowsBuboRuntime({
|
|
|
1149
1223
|
catch { /* ignore */ }
|
|
1150
1224
|
|
|
1151
1225
|
if (os.platform() === 'win32' && isPkZip) {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1226
|
+
const zip = new AdmZip(zipPath);
|
|
1227
|
+
const entries = zip.getEntries();
|
|
1228
|
+
// В релизе bubo все файлы лежат внутри одной корневой папки `bubo-v0.1.2-windows-x64-gfx1151/` —
|
|
1229
|
+
// снимаем этот общий префикс при распаковке, чтобы `bin/bubo.exe` оказался прямо в `#runtime/bubo/bin/bubo.exe`.
|
|
1230
|
+
const topDirs = new Set(entries.map(e => String(e.entryName || '').split('/')[0]).filter(Boolean));
|
|
1231
|
+
const stripPrefix = topDirs.size === 1 ? ([...topDirs][0] + '/') : '';
|
|
1232
|
+
for (const entry of entries) {
|
|
1233
|
+
let rel = String(entry.entryName || '').replace(/^\/+/, '');
|
|
1234
|
+
if (stripPrefix && rel.startsWith(stripPrefix))
|
|
1235
|
+
rel = rel.slice(stripPrefix.length);
|
|
1236
|
+
if (!rel || rel.includes('..'))
|
|
1237
|
+
continue;
|
|
1238
|
+
const dest = path.resolve(buboDir, rel);
|
|
1239
|
+
if (!dest.startsWith(path.resolve(buboDir)))
|
|
1240
|
+
continue;
|
|
1241
|
+
if (entry.isDirectory) {
|
|
1242
|
+
await fsp.mkdir(dest, { recursive: true });
|
|
1243
|
+
}
|
|
1244
|
+
else {
|
|
1245
|
+
await fsp.mkdir(path.dirname(dest), { recursive: true });
|
|
1246
|
+
await fsp.writeFile(dest, entry.getData());
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1161
1249
|
}
|
|
1162
1250
|
envInfo = inspectWindowsHalogenEnvironment({ rootDir });
|
|
1251
|
+
if (os.platform() === 'win32' && !envInfo.buboExePath && spawnImpl === spawn) {
|
|
1252
|
+
throw new Error('После распаковки архива Halowin Bubo не найден файл bin/bubo.exe.');
|
|
1253
|
+
}
|
|
1163
1254
|
}
|
|
1164
1255
|
|
|
1165
1256
|
const buboExe = envInfo.buboExePath || path.join(buboDir, 'bin', 'bubo.exe');
|
|
1257
|
+
if ((step === 'runtime' || step === 'model' || step === 'all') && !fs.existsSync(buboExe)) {
|
|
1258
|
+
throw new Error(`Исполняемый файл bubo.exe не найден по пути: ${buboExe}`);
|
|
1259
|
+
}
|
|
1166
1260
|
|
|
1167
1261
|
// Шаг 2: Установка официальных библиотек AMD ROCm 10.0.0 (`gfx1151`) через `bubo.exe prepare runtime --yes`
|
|
1168
1262
|
if ((step === 'runtime' || step === 'all') && fs.existsSync(buboExe)) {
|
|
@@ -1187,11 +1281,12 @@ export async function prepareWindowsBuboRuntime({
|
|
|
1187
1281
|
|
|
1188
1282
|
// Шаг 3: Подготовка 8 файлов модели Qwen3.8-Flash-Next (UD-Q4_K_XL + MTP + Dense Twin + Draft Head + Vision)
|
|
1189
1283
|
if ((step === 'model' || step === 'all') && fs.existsSync(buboExe)) {
|
|
1190
|
-
appendLog(`Подготовка модели Qwen3.8-Flash-Next (${modelSet},
|
|
1284
|
+
appendLog(`Подготовка модели Qwen3.8-Flash-Next (${modelSet}${offline ? ', проверка локальных файлов' : ''}) через bubo prepare model…`);
|
|
1191
1285
|
_windowsPrepareState.progress = Math.max(_windowsPrepareState.progress, 45);
|
|
1192
1286
|
const args = [
|
|
1193
1287
|
'prepare', 'model',
|
|
1194
1288
|
...(modelSet === 'original' ? ['--model-set', 'original'] : []),
|
|
1289
|
+
...(offline ? ['--offline'] : []),
|
|
1195
1290
|
'--output', modelsOutDir,
|
|
1196
1291
|
'--yes',
|
|
1197
1292
|
];
|
|
@@ -1792,6 +1887,54 @@ export async function ensureHalogenModelNodes(rootDir = process.cwd(), { models
|
|
|
1792
1887
|
return registered;
|
|
1793
1888
|
}
|
|
1794
1889
|
|
|
1890
|
+
/**
|
|
1891
|
+
* Финализировать установленные файлы Windows-модели `Qwen3.8-Flash-Next`:
|
|
1892
|
+
* установить `bubo.exe` + ROCm 10.0.0 `gfx1151` (если ещё не стоят) и сгенерировать `bubo-package.json` через `bubo prepare model --offline`.
|
|
1893
|
+
*/
|
|
1894
|
+
export async function finalizeWindowsBuboModel({
|
|
1895
|
+
rootDir = process.cwd(),
|
|
1896
|
+
fetchImpl = globalThis.fetch,
|
|
1897
|
+
spawnImpl = spawn,
|
|
1898
|
+
} = {}) {
|
|
1899
|
+
let envInfo = inspectWindowsHalogenEnvironment({ rootDir });
|
|
1900
|
+
if (!envInfo.buboInstalled || !envInfo.rocmRuntimePrepared) {
|
|
1901
|
+
const rtRes = await prepareWindowsBuboRuntime({
|
|
1902
|
+
rootDir,
|
|
1903
|
+
step: 'runtime',
|
|
1904
|
+
fetchImpl,
|
|
1905
|
+
spawnImpl,
|
|
1906
|
+
});
|
|
1907
|
+
if (!rtRes.ok)
|
|
1908
|
+
throw new Error(rtRes.error || 'Не удалось установить встроенный движок Halowin Bubo (ROCm 10.0 gfx1151)');
|
|
1909
|
+
}
|
|
1910
|
+
envInfo = inspectWindowsHalogenEnvironment({ rootDir });
|
|
1911
|
+
if (!envInfo.buboModelPrepared) {
|
|
1912
|
+
// Сначала пробуем --offline (быстрая проверка уже скачанных 8 файлов),
|
|
1913
|
+
// если вдруг не хватает лицензионных файлов — разрешаем bubo дозаписать их онлайн без повторной загрузки шардов.
|
|
1914
|
+
let modRes = await prepareWindowsBuboRuntime({
|
|
1915
|
+
rootDir,
|
|
1916
|
+
step: 'model',
|
|
1917
|
+
modelSet: 'original',
|
|
1918
|
+
offline: true,
|
|
1919
|
+
fetchImpl,
|
|
1920
|
+
spawnImpl,
|
|
1921
|
+
});
|
|
1922
|
+
if (!modRes.ok) {
|
|
1923
|
+
modRes = await prepareWindowsBuboRuntime({
|
|
1924
|
+
rootDir,
|
|
1925
|
+
step: 'model',
|
|
1926
|
+
modelSet: 'original',
|
|
1927
|
+
offline: false,
|
|
1928
|
+
fetchImpl,
|
|
1929
|
+
spawnImpl,
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
if (!modRes.ok)
|
|
1933
|
+
throw new Error(modRes.error || 'Не удалось сгенерировать манифест bubo-package.json');
|
|
1934
|
+
}
|
|
1935
|
+
return { ok: true, windowsEnv: inspectWindowsHalogenEnvironment({ rootDir }) };
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1795
1938
|
/**
|
|
1796
1939
|
* Проверить наличие скачанных весов и узлов `$ai` для каждой модели Halo, совместимой с текущей ОС.
|
|
1797
1940
|
*/
|
|
@@ -1820,13 +1963,14 @@ export function inspectHalogenCatalogWithStatus(rootDir = process.cwd(), { platf
|
|
|
1820
1963
|
&& (d.repoId === spec.hfRepo || d.folderName === spec.nodeName || d.modelPath === spec.path)
|
|
1821
1964
|
) || null;
|
|
1822
1965
|
|
|
1823
|
-
if (!activeJob && platform === 'win32' && spec.nodeName === 'Qwen3.8-Flash-Next' && _windowsPrepareState.status === 'running') {
|
|
1966
|
+
if (!activeJob && platform === 'win32' && spec.nodeName === 'Qwen3.8-Flash-Next' && (_windowsPrepareState.status === 'running' || _windowsPrepareState.status === 'error')) {
|
|
1824
1967
|
activeJob = {
|
|
1825
1968
|
id: 'bubo_prepare',
|
|
1826
1969
|
repoId: spec.windowsBuboRepo || spec.hfRepo,
|
|
1827
1970
|
folderName: spec.nodeName,
|
|
1828
1971
|
label: spec.label,
|
|
1829
|
-
status: 'downloading',
|
|
1972
|
+
status: _windowsPrepareState.status === 'error' ? 'failed' : 'downloading',
|
|
1973
|
+
error: _windowsPrepareState.error || '',
|
|
1830
1974
|
progress: _windowsPrepareState.progress || 5,
|
|
1831
1975
|
downloadedBytes: 0,
|
|
1832
1976
|
totalBytes: 0,
|
|
@@ -1902,42 +2046,6 @@ export async function downloadHalogenBundle({
|
|
|
1902
2046
|
let alreadyActiveCount = 0;
|
|
1903
2047
|
|
|
1904
2048
|
for (const spec of targets) {
|
|
1905
|
-
if (spec.runtimeType === 'bubo') {
|
|
1906
|
-
if (_windowsPrepareState.status === 'running') {
|
|
1907
|
-
alreadyActiveCount++;
|
|
1908
|
-
jobs.push({
|
|
1909
|
-
id: 'bubo_prepare',
|
|
1910
|
-
folderName: spec.nodeName,
|
|
1911
|
-
status: 'downloading',
|
|
1912
|
-
progress: _windowsPrepareState.progress,
|
|
1913
|
-
});
|
|
1914
|
-
}
|
|
1915
|
-
else {
|
|
1916
|
-
const runPrep = prepareWindowsBuboRuntime({
|
|
1917
|
-
rootDir,
|
|
1918
|
-
step: 'all',
|
|
1919
|
-
modelSet: 'original',
|
|
1920
|
-
fetchImpl,
|
|
1921
|
-
});
|
|
1922
|
-
if (waitForCompletion) {
|
|
1923
|
-
const res = await runPrep;
|
|
1924
|
-
if (!res.ok)
|
|
1925
|
-
throw new Error(res.error || 'Не удалось подготовить Halowin Bubo');
|
|
1926
|
-
}
|
|
1927
|
-
else {
|
|
1928
|
-
runPrep.catch(() => {});
|
|
1929
|
-
}
|
|
1930
|
-
startedCount++;
|
|
1931
|
-
jobs.push({
|
|
1932
|
-
id: 'bubo_prepare',
|
|
1933
|
-
folderName: spec.nodeName,
|
|
1934
|
-
status: _windowsPrepareState.status === 'completed' ? 'completed' : 'downloading',
|
|
1935
|
-
progress: _windowsPrepareState.progress,
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
continue;
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
2049
|
const running = existingDownloads.find(d =>
|
|
1942
2050
|
d.status === 'downloading'
|
|
1943
2051
|
&& (d.repoId === spec.hfRepo || d.folderName === spec.nodeName || d.modelPath === spec.path)
|
|
@@ -1947,6 +2055,40 @@ export async function downloadHalogenBundle({
|
|
|
1947
2055
|
jobs.push(running);
|
|
1948
2056
|
continue;
|
|
1949
2057
|
}
|
|
2058
|
+
|
|
2059
|
+
if (spec.runtimeType === 'bubo') {
|
|
2060
|
+
const job = await startHuggingFaceDownload({
|
|
2061
|
+
repoId: spec.windowsBuboRepo || 'unsloth/Qwen3.8-Flash-Next-GGUF',
|
|
2062
|
+
customFiles: BUBO_ORIGINAL_MODEL_FILES,
|
|
2063
|
+
customFilesDir: BUBO_ORIGINAL_MODEL_DIR_REL,
|
|
2064
|
+
onComplete: ({ rootDir: rd }) => finalizeWindowsBuboModel({ rootDir: rd, fetchImpl }),
|
|
2065
|
+
providerFolder: 'Local',
|
|
2066
|
+
targetNodeName: spec.nodeName,
|
|
2067
|
+
platform,
|
|
2068
|
+
nodeMeta: {
|
|
2069
|
+
label: spec.label || spec.nodeName,
|
|
2070
|
+
model: spec.model,
|
|
2071
|
+
protocol: 'halogen',
|
|
2072
|
+
icon: spec.icon || 'ai:qwen',
|
|
2073
|
+
modality: spec.modality,
|
|
2074
|
+
capabilities: spec.capabilities,
|
|
2075
|
+
efforts: spec.efforts,
|
|
2076
|
+
maxTokens: spec.maxTokens,
|
|
2077
|
+
maxOutput: spec.maxOutput,
|
|
2078
|
+
baseUrl: spec.baseUrl || HALOGEN_DEFAULT_BASE_URL,
|
|
2079
|
+
primaryFile: 'bubo-package.json',
|
|
2080
|
+
},
|
|
2081
|
+
rootDir,
|
|
2082
|
+
token,
|
|
2083
|
+
registerInWork: true,
|
|
2084
|
+
waitForCompletion,
|
|
2085
|
+
fetchImpl,
|
|
2086
|
+
});
|
|
2087
|
+
startedCount++;
|
|
2088
|
+
jobs.push(job);
|
|
2089
|
+
continue;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
1950
2092
|
const job = await startHuggingFaceDownload({
|
|
1951
2093
|
repoId: spec.hfRepo,
|
|
1952
2094
|
providerFolder: 'Local',
|
|
@@ -1141,8 +1141,12 @@ async function writeDownloadStateSafe(stagingDir, job, extra = {}) {
|
|
|
1141
1141
|
threads: Number(job.threads) || 1,
|
|
1142
1142
|
registerInWork: extra.registerInWork !== false,
|
|
1143
1143
|
nodeMeta: extra.nodeMeta || null,
|
|
1144
|
+
customFilesDir: extra.customFilesDir || '',
|
|
1145
|
+
buboFinalize: Boolean(extra.buboFinalize),
|
|
1144
1146
|
files: (job.files || []).map(f => ({
|
|
1145
1147
|
name: f.name,
|
|
1148
|
+
...(f.url ? { url: f.url } : {}),
|
|
1149
|
+
...(f.destRelPath ? { destRelPath: f.destRelPath } : {}),
|
|
1146
1150
|
size: Number(f.size) || 0,
|
|
1147
1151
|
downloaded: Number(f.downloaded) || 0,
|
|
1148
1152
|
done: Boolean(f.done),
|
|
@@ -1210,6 +1214,9 @@ export function computeDownloadEta({ remainingBytes = 0, avgBytesPerSec = 0, sho
|
|
|
1210
1214
|
export async function startHuggingFaceDownload({
|
|
1211
1215
|
repoId,
|
|
1212
1216
|
files = null,
|
|
1217
|
+
customFiles = null,
|
|
1218
|
+
customFilesDir = '',
|
|
1219
|
+
onComplete = null,
|
|
1213
1220
|
quant = 'Q8_0',
|
|
1214
1221
|
revision = 'main',
|
|
1215
1222
|
token = '',
|
|
@@ -1255,15 +1262,28 @@ export async function startHuggingFaceDownload({
|
|
|
1255
1262
|
const effToken = token || netCfg.token || '';
|
|
1256
1263
|
const netFetch = createNetworkFetch({ proxyUrl: effProxy, fetchImpl });
|
|
1257
1264
|
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1265
|
+
let repoMeta = { modality: nodeMeta?.modality || 'llm', capabilities: nodeMeta?.capabilities || ['chat'], files: [] };
|
|
1266
|
+
let selected = [];
|
|
1267
|
+
if (Array.isArray(customFiles) && customFiles.length) {
|
|
1268
|
+
selected = customFiles.map(cf => ({
|
|
1269
|
+
name: String(cf.name || ''),
|
|
1270
|
+
url: String(cf.url || ''),
|
|
1271
|
+
destRelPath: String(cf.destRelPath || path.basename(cf.name || '')),
|
|
1272
|
+
size: Number(cf.size) || 0,
|
|
1273
|
+
kind: /\.gguf$/i.test(cf.name || '') ? 'gguf' : 'safetensors',
|
|
1274
|
+
}));
|
|
1275
|
+
}
|
|
1276
|
+
else {
|
|
1277
|
+
repoMeta = await inspectHuggingFaceRepo(cleanId, {
|
|
1278
|
+
revision,
|
|
1279
|
+
token: effToken,
|
|
1280
|
+
rootDir,
|
|
1281
|
+
endpointUrl: effEndpoint,
|
|
1282
|
+
proxyUrl: effProxy,
|
|
1283
|
+
fetchImpl,
|
|
1284
|
+
});
|
|
1285
|
+
selected = selectFilesToDownload(repoMeta, { files, quant });
|
|
1286
|
+
}
|
|
1267
1287
|
if (!selected.length)
|
|
1268
1288
|
throw new Error(`В репозитории ${cleanId} не найдено подходящих файлов весов (.gguf / .safetensors)`);
|
|
1269
1289
|
|
|
@@ -1282,6 +1302,8 @@ export async function startHuggingFaceDownload({
|
|
|
1282
1302
|
const modelDir = getModelDir(rootDir, folderName, safeProvider);
|
|
1283
1303
|
const weightsDir = getModelWeightsDir(rootDir, folderName, safeProvider);
|
|
1284
1304
|
const stagingDir = weightsDir;
|
|
1305
|
+
const filesRootDir = customFilesDir ? path.resolve(rootDir, customFilesDir) : stagingDir;
|
|
1306
|
+
const customFilesDirRel = customFilesDir ? path.relative(rootDir, filesRootDir).replace(/\\/g, '/') : '';
|
|
1285
1307
|
const primary = selected.find(f => f.name.endsWith('.gguf'))?.name
|
|
1286
1308
|
|| selected.find(f => f.name.endsWith('.safetensors') || f.name.endsWith('.hgn') || f.name.endsWith('.hnpw'))?.name
|
|
1287
1309
|
|| selected[0]?.name || '';
|
|
@@ -1290,6 +1312,8 @@ export async function startHuggingFaceDownload({
|
|
|
1290
1312
|
|| `${cleanId.split('/')[1] || cleanId}${quant && primary.endsWith('.gguf') ? ' (' + quant + ')' : ''}`;
|
|
1291
1313
|
|
|
1292
1314
|
await fsp.mkdir(weightsDir, { recursive: true });
|
|
1315
|
+
if (filesRootDir !== stagingDir)
|
|
1316
|
+
await fsp.mkdir(filesRootDir, { recursive: true });
|
|
1293
1317
|
|
|
1294
1318
|
// Если осталась недокачанная старая папка в #downloads/<folderName>, аккуратно перенесём её в $ai/#weights
|
|
1295
1319
|
const legacyStaging = path.join(rootDir, 'MODELS', safeProvider, '#downloads', folderName);
|
|
@@ -1335,7 +1359,8 @@ export async function startHuggingFaceDownload({
|
|
|
1335
1359
|
const jobFiles = [];
|
|
1336
1360
|
for (const f of selected) {
|
|
1337
1361
|
const size = Number(f.size) || 0;
|
|
1338
|
-
const
|
|
1362
|
+
const destRelPath = f.destRelPath || path.basename(f.name);
|
|
1363
|
+
const stagedFile = path.join(filesRootDir, destRelPath);
|
|
1339
1364
|
const partFile = stagedFile + '.part';
|
|
1340
1365
|
let downloaded = 0;
|
|
1341
1366
|
let done = false;
|
|
@@ -1367,7 +1392,15 @@ export async function startHuggingFaceDownload({
|
|
|
1367
1392
|
}
|
|
1368
1393
|
catch { /* .part ещё нет */ }
|
|
1369
1394
|
}
|
|
1370
|
-
jobFiles.push({
|
|
1395
|
+
jobFiles.push({
|
|
1396
|
+
name: f.name,
|
|
1397
|
+
...(f.url ? { url: f.url } : {}),
|
|
1398
|
+
...(f.destRelPath ? { destRelPath: f.destRelPath } : {}),
|
|
1399
|
+
size: size || (done ? downloaded : 0),
|
|
1400
|
+
downloaded,
|
|
1401
|
+
done,
|
|
1402
|
+
ranges,
|
|
1403
|
+
});
|
|
1371
1404
|
}
|
|
1372
1405
|
|
|
1373
1406
|
const jobId = 'hf_' + crypto.randomUUID().slice(0, 8);
|
|
@@ -1397,6 +1430,8 @@ export async function startHuggingFaceDownload({
|
|
|
1397
1430
|
rootDir,
|
|
1398
1431
|
stagingDir,
|
|
1399
1432
|
weightsDir,
|
|
1433
|
+
filesRootDir,
|
|
1434
|
+
customFilesDir: customFilesDirRel,
|
|
1400
1435
|
endpointUrl: effEndpoint,
|
|
1401
1436
|
sourceLabel: describeSourceLabel(effEndpoint),
|
|
1402
1437
|
threads: effThreads,
|
|
@@ -1428,12 +1463,15 @@ export async function startHuggingFaceDownload({
|
|
|
1428
1463
|
registerInWork,
|
|
1429
1464
|
quant,
|
|
1430
1465
|
files,
|
|
1466
|
+
customFiles: Array.isArray(customFiles) && customFiles.length ? customFiles : null,
|
|
1467
|
+
customFilesDir: customFilesDirRel,
|
|
1468
|
+
onComplete,
|
|
1431
1469
|
fetchImpl,
|
|
1432
1470
|
runPromise: null,
|
|
1433
1471
|
setKeepFiles: (v) => { keepFilesOnAbort = Boolean(v); },
|
|
1434
1472
|
};
|
|
1435
1473
|
_downloads.set(jobId, entryMeta);
|
|
1436
|
-
await writeDownloadStateSafe(stagingDir, job, { nodeMeta, registerInWork });
|
|
1474
|
+
await writeDownloadStateSafe(stagingDir, job, { nodeMeta, registerInWork, customFilesDir: customFilesDirRel, buboFinalize: Boolean(onComplete) });
|
|
1437
1475
|
|
|
1438
1476
|
const runPromise = (async () => {
|
|
1439
1477
|
const t0 = Date.now();
|
|
@@ -1449,7 +1487,7 @@ export async function startHuggingFaceDownload({
|
|
|
1449
1487
|
stateWriteChain = stateWriteChain.then(() => {
|
|
1450
1488
|
if (downloadFinished)
|
|
1451
1489
|
return;
|
|
1452
|
-
return writeDownloadStateSafe(weightsDir, job, { nodeMeta, registerInWork });
|
|
1490
|
+
return writeDownloadStateSafe(weightsDir, job, { nodeMeta, registerInWork, customFilesDir: customFilesDirRel, buboFinalize: Boolean(onComplete) });
|
|
1453
1491
|
}).catch(() => {});
|
|
1454
1492
|
};
|
|
1455
1493
|
|
|
@@ -1517,10 +1555,18 @@ export async function startHuggingFaceDownload({
|
|
|
1517
1555
|
if (controller.signal.aborted)
|
|
1518
1556
|
throw new Error('Загрузка приостановлена пользователем');
|
|
1519
1557
|
job.currentFile = fileEntry.name;
|
|
1520
|
-
const
|
|
1558
|
+
const destRelPath = fileEntry.destRelPath || path.basename(fileEntry.name);
|
|
1559
|
+
const stagedFile = path.join(filesRootDir, destRelPath);
|
|
1560
|
+
await fsp.mkdir(path.dirname(stagedFile), { recursive: true });
|
|
1521
1561
|
const partFile = stagedFile + '.part';
|
|
1522
|
-
|
|
1523
|
-
|
|
1562
|
+
let url;
|
|
1563
|
+
if (fileEntry.url) {
|
|
1564
|
+
url = String(fileEntry.url).replace(/^https:\/\/huggingface\.co(?=\/)/i, effEndpoint);
|
|
1565
|
+
}
|
|
1566
|
+
else {
|
|
1567
|
+
const encodedPath = fileEntry.name.split('/').map(encodeURIComponent).join('/');
|
|
1568
|
+
url = `${effEndpoint}/${cleanId}/resolve/${encodeURIComponent(job.revision)}/${encodedPath}`;
|
|
1569
|
+
}
|
|
1524
1570
|
const headers = hfHeaders(effToken, url, effEndpoint);
|
|
1525
1571
|
|
|
1526
1572
|
const res = await downloadFileMultipart({
|
|
@@ -1613,11 +1659,16 @@ export async function startHuggingFaceDownload({
|
|
|
1613
1659
|
maxTokens: nodeMeta?.maxTokens,
|
|
1614
1660
|
maxOutput: nodeMeta?.maxOutput,
|
|
1615
1661
|
baseUrl: nodeMeta?.baseUrl,
|
|
1616
|
-
weightsDir,
|
|
1617
|
-
primaryFile: path.basename(primary),
|
|
1662
|
+
weightsDir: filesRootDir,
|
|
1663
|
+
primaryFile: nodeMeta?.primaryFile || path.basename(primary),
|
|
1618
1664
|
});
|
|
1619
1665
|
}
|
|
1620
1666
|
|
|
1667
|
+
if (typeof onComplete === 'function') {
|
|
1668
|
+
job.currentFile = 'Настройка встроенного движка…';
|
|
1669
|
+
await onComplete({ job, weightsDir, filesRootDir, rootDir });
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1621
1672
|
job.progress = 100;
|
|
1622
1673
|
job.etaSeconds = 0;
|
|
1623
1674
|
job.status = 'completed';
|
|
@@ -1745,6 +1796,11 @@ export function listHuggingFaceDownloads(rootDir = process.cwd()) {
|
|
|
1745
1796
|
}
|
|
1746
1797
|
catch { /* ignore */ }
|
|
1747
1798
|
}
|
|
1799
|
+
if (diskBytes <= 0 && Array.isArray(state.files)) {
|
|
1800
|
+
for (const sf of state.files) {
|
|
1801
|
+
diskBytes += Number(sf?.downloaded) || 0;
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1748
1804
|
if (diskBytes <= 0 && !state.repoId)
|
|
1749
1805
|
continue;
|
|
1750
1806
|
const totalBytes = Number(state.totalBytes) || 0;
|
|
@@ -1797,7 +1853,12 @@ export function pauseHuggingFaceDownload(jobId) {
|
|
|
1797
1853
|
entry.job.status = 'paused';
|
|
1798
1854
|
entry.job.etaSeconds = null;
|
|
1799
1855
|
entry.job.finishedAt = Date.now();
|
|
1800
|
-
writeDownloadStateSafe(entry.job.stagingDir, entry.job, {
|
|
1856
|
+
writeDownloadStateSafe(entry.job.stagingDir, entry.job, {
|
|
1857
|
+
nodeMeta: entry.nodeMeta,
|
|
1858
|
+
registerInWork: entry.registerInWork,
|
|
1859
|
+
customFilesDir: entry.customFilesDir || '',
|
|
1860
|
+
buboFinalize: Boolean(entry.onComplete),
|
|
1861
|
+
});
|
|
1801
1862
|
return { ...entry.job };
|
|
1802
1863
|
}
|
|
1803
1864
|
|
|
@@ -1816,6 +1877,18 @@ export async function discardHuggingFaceDownload({ jobId = '', folderName = '',
|
|
|
1816
1877
|
targetFolder = key.slice(5);
|
|
1817
1878
|
if (targetFolder) {
|
|
1818
1879
|
const weightsDir = getModelWeightsDir(rootDir, targetFolder, 'Local');
|
|
1880
|
+
let customDirAbs = entry?.customFilesDir ? path.resolve(rootDir, entry.customFilesDir) : '';
|
|
1881
|
+
if (!customDirAbs && fs.existsSync(path.join(weightsDir, DOWNLOAD_STATE_FILE))) {
|
|
1882
|
+
try {
|
|
1883
|
+
const st = JSON.parse(await fsp.readFile(path.join(weightsDir, DOWNLOAD_STATE_FILE), 'utf-8'));
|
|
1884
|
+
if (st?.customFilesDir)
|
|
1885
|
+
customDirAbs = path.resolve(rootDir, st.customFilesDir);
|
|
1886
|
+
}
|
|
1887
|
+
catch { /* ignore */ }
|
|
1888
|
+
}
|
|
1889
|
+
if (customDirAbs && fs.existsSync(customDirAbs)) {
|
|
1890
|
+
await fsp.rm(customDirAbs, { recursive: true, force: true }).catch(() => {});
|
|
1891
|
+
}
|
|
1819
1892
|
if (fs.existsSync(weightsDir)) {
|
|
1820
1893
|
await fsp.rm(path.join(weightsDir, DOWNLOAD_STATE_FILE), { force: true }).catch(() => {});
|
|
1821
1894
|
const files = await fsp.readdir(weightsDir).catch(() => []);
|
|
@@ -1837,6 +1910,9 @@ export async function resumeHuggingFaceDownload({
|
|
|
1837
1910
|
folderName = '',
|
|
1838
1911
|
repoId = '',
|
|
1839
1912
|
files = null,
|
|
1913
|
+
customFiles = null,
|
|
1914
|
+
customFilesDir = '',
|
|
1915
|
+
onComplete = null,
|
|
1840
1916
|
quant = 'Q8_0',
|
|
1841
1917
|
token = '',
|
|
1842
1918
|
nodeMeta = null,
|
|
@@ -1865,6 +1941,9 @@ export async function resumeHuggingFaceDownload({
|
|
|
1865
1941
|
if (!resolvedRepo)
|
|
1866
1942
|
throw new Error(`Не удалось определить репозиторий Hugging Face для докачки «${cleanFolder || key}»`);
|
|
1867
1943
|
|
|
1944
|
+
const stateHasCustomUrls = Array.isArray(state.files) && state.files.some(f => f?.url || f?.destRelPath);
|
|
1945
|
+
const resolvedCustomFiles = customFiles ?? entry?.customFiles ?? (stateHasCustomUrls ? state.files : null);
|
|
1946
|
+
const resolvedCustomDir = customFilesDir || entry?.customFilesDir || state.customFilesDir || '';
|
|
1868
1947
|
const stateFileNames = Array.isArray(state.files) && state.files.length
|
|
1869
1948
|
? state.files.map(f => f?.name).filter(Boolean)
|
|
1870
1949
|
: null;
|
|
@@ -1872,6 +1951,9 @@ export async function resumeHuggingFaceDownload({
|
|
|
1872
1951
|
return startHuggingFaceDownload({
|
|
1873
1952
|
repoId: resolvedRepo,
|
|
1874
1953
|
files: files ?? entry?.files ?? stateFileNames ?? null,
|
|
1954
|
+
customFiles: resolvedCustomFiles,
|
|
1955
|
+
customFilesDir: resolvedCustomDir,
|
|
1956
|
+
onComplete: onComplete || entry?.onComplete || null,
|
|
1875
1957
|
quant: quant || entry?.quant || 'Q8_0',
|
|
1876
1958
|
revision: entry?.job?.revision || state.revision || 'main',
|
|
1877
1959
|
token,
|
|
@@ -1904,6 +1986,9 @@ export async function restartActiveHuggingFaceDownloads({ rootDir = '' } = {}) {
|
|
|
1904
1986
|
folderName: entry.job.folderName,
|
|
1905
1987
|
repoId: entry.job.repoId,
|
|
1906
1988
|
files: entry.files ?? null,
|
|
1989
|
+
customFiles: entry.customFiles ?? null,
|
|
1990
|
+
customFilesDir: entry.customFilesDir || '',
|
|
1991
|
+
onComplete: entry.onComplete || null,
|
|
1907
1992
|
quant: entry.quant || 'Q8_0',
|
|
1908
1993
|
nodeMeta: entry.nodeMeta || null,
|
|
1909
1994
|
rootDir: entry.job.rootDir || process.cwd(),
|
|
@@ -65,6 +65,9 @@ import {
|
|
|
65
65
|
computeHalogenMemoryPlan,
|
|
66
66
|
inspectWindowsHalogenEnvironment,
|
|
67
67
|
prepareWindowsBuboRuntime,
|
|
68
|
+
finalizeWindowsBuboModel,
|
|
69
|
+
BUBO_ORIGINAL_MODEL_DIR_REL,
|
|
70
|
+
BUBO_ORIGINAL_MODEL_FILES,
|
|
68
71
|
probeHalogenServer,
|
|
69
72
|
startHalogenBackend,
|
|
70
73
|
stopHalogenBackend,
|
|
@@ -173,6 +176,9 @@ export {
|
|
|
173
176
|
computeHalogenMemoryPlan,
|
|
174
177
|
inspectWindowsHalogenEnvironment,
|
|
175
178
|
prepareWindowsBuboRuntime,
|
|
179
|
+
finalizeWindowsBuboModel,
|
|
180
|
+
BUBO_ORIGINAL_MODEL_DIR_REL,
|
|
181
|
+
BUBO_ORIGINAL_MODEL_FILES,
|
|
176
182
|
probeHalogenServer,
|
|
177
183
|
startHalogenBackend,
|
|
178
184
|
stopHalogenBackend,
|
|
@@ -762,27 +768,35 @@ export const TRAINER_METHODS = Object.freeze({
|
|
|
762
768
|
fn: async function (p = {}) {
|
|
763
769
|
const args = mergeTrainerArgs(p);
|
|
764
770
|
const folderName = args.folderName || '';
|
|
765
|
-
const
|
|
771
|
+
const platformCatalog = getHalogenCatalogForPlatform(os.platform());
|
|
772
|
+
const haloSpec = platformCatalog.find(m =>
|
|
766
773
|
(folderName && m.nodeName === folderName)
|
|
767
774
|
|| (args.repoId && m.hfRepo === args.repoId)
|
|
768
775
|
);
|
|
776
|
+
const isWinBubo = os.platform() === 'win32' && (haloSpec?.runtimeType === 'bubo' || folderName === 'Qwen3.8-Flash-Next');
|
|
769
777
|
const job = await resumeHuggingFaceDownload({
|
|
770
778
|
jobId: args.jobId ?? args.id ?? '',
|
|
771
779
|
folderName,
|
|
772
|
-
repoId: args.repoId || haloSpec?.hfRepo || '',
|
|
780
|
+
repoId: isWinBubo ? (haloSpec?.windowsBuboRepo || 'unsloth/Qwen3.8-Flash-Next-GGUF') : (args.repoId || haloSpec?.hfRepo || ''),
|
|
781
|
+
...(isWinBubo ? {
|
|
782
|
+
customFiles: BUBO_ORIGINAL_MODEL_FILES,
|
|
783
|
+
customFilesDir: BUBO_ORIGINAL_MODEL_DIR_REL,
|
|
784
|
+
onComplete: ({ rootDir: rd }) => finalizeWindowsBuboModel({ rootDir: rd }),
|
|
785
|
+
} : {}),
|
|
773
786
|
quant: args.quant || 'Q8_0',
|
|
774
787
|
token: args.token || '',
|
|
775
788
|
nodeMeta: haloSpec ? {
|
|
776
789
|
label: haloSpec.label || haloSpec.nodeName,
|
|
777
790
|
model: haloSpec.model,
|
|
778
|
-
protocol: '
|
|
791
|
+
protocol: haloSpec.protocol || 'local',
|
|
779
792
|
icon: haloSpec.icon || 'ai:qwen',
|
|
780
793
|
modality: haloSpec.modality,
|
|
781
794
|
capabilities: haloSpec.capabilities,
|
|
782
795
|
efforts: haloSpec.efforts,
|
|
783
796
|
maxTokens: haloSpec.maxTokens,
|
|
784
797
|
maxOutput: haloSpec.maxOutput,
|
|
785
|
-
baseUrl: haloSpec.baseUrl
|
|
798
|
+
baseUrl: haloSpec.baseUrl ?? '',
|
|
799
|
+
...(isWinBubo ? { primaryFile: 'bubo-package.json' } : {}),
|
|
786
800
|
} : null,
|
|
787
801
|
});
|
|
788
802
|
try {
|
|
@@ -473,6 +473,13 @@ export async function deleteLocalModel({ rootDir = process.cwd(), modelId } = {}
|
|
|
473
473
|
if (fs.existsSync(targetDir)) {
|
|
474
474
|
await fsp.rm(targetDir, { recursive: true, force: true });
|
|
475
475
|
}
|
|
476
|
+
if (cleanId === 'Qwen3.8-Flash-Next') {
|
|
477
|
+
for (const sub of ['qwen38-flash-next-base-ud-q4-k-xl-v1', 'huihui-qwen38-flash-next-ud-q4-k-xl-v1']) {
|
|
478
|
+
const buboDir = path.join(localRoot, 'models', sub);
|
|
479
|
+
if (fs.existsSync(buboDir))
|
|
480
|
+
await fsp.rm(buboDir, { recursive: true, force: true }).catch(() => {});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
476
483
|
return { ok: true, deletedId: cleanId, deletedPath: `/MODELS/Local/${cleanId}` };
|
|
477
484
|
}
|
|
478
485
|
|