odant-work 1.0.32 → 1.0.33
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 +11 -11
- package/package.json +1 -1
- package/sources/data/progress.md +4 -0
- package/sources/modules/trainer/halogen.js +114 -182
- package/sources/modules/trainer/huggingface.js +2 -1
- package/sources/modules/trainer/index.js +27 -10
- package/sources/modules/trainer/paths.js +52 -4
- package/sources/modules/trainer/providers.js +4 -8
- package/sources/modules/trainer/runner.js +5 -9
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "odant-work",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"createdAt": 1794658837090,
|
|
5
|
-
"updatedAt":
|
|
5
|
+
"updatedAt": 1794899882362,
|
|
6
6
|
"files": {
|
|
7
7
|
"run.mjs": "f8918c612e8641e9beee06221be6680aa6fd21f25468451f2ac857fd51772266",
|
|
8
|
-
"package.json": "
|
|
9
|
-
"package-lock.json": "
|
|
8
|
+
"package.json": "66825cd9230bfe15f6c063e76d52cefe3419c97d78d7a832892656bab4752a62",
|
|
9
|
+
"package-lock.json": "7b20f4d32c36a3d87e0aa0449c40af406a6e213891f46eeb70f9f6f64966f479",
|
|
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": "85aa3d098a9e957e77c1ac9db0aafecb0d9b3deeb969997df333796d54302f39",
|
|
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": "d4e71304669ef55e02549bbd75c50eee5b9accdd53bd3f8431cfa377f7572d8f",
|
|
180
|
+
"sources/modules/trainer/huggingface.js": "91878bb2975981e02dd21d2a587d7c345ef65cd2d7032c5769a63c9dba21f982",
|
|
181
|
+
"sources/modules/trainer/index.js": "dd3c6336eb08410084d0826bf68afae55ab8ab39b2353c0a928ece75f28d4dea",
|
|
182
182
|
"sources/modules/trainer/local-engine.js": "0aa161d9800be79534e8fcb8271c418a5e342d29244c95cd448e7df6d6b15458",
|
|
183
|
-
"sources/modules/trainer/paths.js": "
|
|
184
|
-
"sources/modules/trainer/providers.js": "
|
|
185
|
-
"sources/modules/trainer/runner.js": "
|
|
183
|
+
"sources/modules/trainer/paths.js": "86d12a1f3a79127c2284a5e0eaf4f523fbf0f3aa8e13b92d8889ebf4fa5400f4",
|
|
184
|
+
"sources/modules/trainer/providers.js": "56ffd2de03449ecaa13751a7e82c615cf5f84e6f02bb0b34c4432c3d85db28da",
|
|
185
|
+
"sources/modules/trainer/runner.js": "328843672fe0c1bd7e8c35c2e25285c31a9f749e04814e64c32e8cae74086024",
|
|
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",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odant-work",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "sources/work.js",
|
package/sources/data/progress.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Прогресс: sources/data
|
|
2
2
|
|
|
3
3
|
## Последние изменения
|
|
4
|
+
- [09:40, 17.11] Разделение движка `bubo` (`$provider/#runtime/bubo/`) и весов нейросети `Qwen3.8-Flash-Next` (`$ai/#weights/`) по архитектуре WORK (`sources/modules/trainer/{halogen,paths,runner,providers,huggingface,index}.js`, `tests/halogen-provider.test.js`, `odant-work@1.0.33`):
|
|
5
|
+
- **Убрана ошибочная папка `MODELS/Local/models/` и зависимость от `bubo prepare model` / `bubo-package.json`:** `bubo.exe` (+ `ROCm 10.0.0`) используется строго как общий движок инференса в `MODELS/Local/$provider/#runtime/bubo/`, а все 8 GGUF-файлов `Qwen3.8-Flash-Next` (`QWEN_FLASH_NEXT_GGUF_FILES`) теперь качаются штатным загрузчиком WORK прямо в метапапку модели `MODELS/Local/Qwen3.8-Flash-Next/$ai/#weights/`.
|
|
6
|
+
- **Прямой запуск `bubo.exe serve llm` (`resolveBuboModelFiles`):** движок запускается напрямую с флагами `--model`, `--mtp-model`, `--mmproj`, `--twin-model`, `--draft-head-model`; при этом инспектор и резолвер весов (`paths.js`, `halogen.js`) поддерживают как плоскую раскладку в `#weights/`, так и подпапки `mtp/`, `mmproj/`, `twin/`, `draft_head/` после ручного переноса файлов.
|
|
7
|
+
- **Авто-миграция v1.0.32 и авто-починка `$ai/class.js` (`migrateLocalModelsLayoutSync`, `trainer_model_info`):** файлы из старой папки `MODELS/Local/models/qwen38-*` автоматически переносятся в `MODELS/Local/Qwen3.8-Flash-Next/$ai/#weights/`, а `weightsDir` и `primaryFile` в `class.js` автоматически обновляются с `bubo-package.json` на первый шард GGUF.
|
|
4
8
|
- [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
9
|
- **Устранена причина остановки на «Распаковка архива 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
10
|
- **Штатная многопоточная загрузка `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`.
|
|
@@ -70,11 +70,10 @@ export const BUBO_WINDOWS_RELEASE = Object.freeze({
|
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* Точные 8
|
|
74
|
-
* для скачивания штатным многопоточным загрузчиком WORK
|
|
73
|
+
* Точные 8 GGUF-файлов сети `Qwen3.8-Flash-Next` (`UD-Q4_K_XL` + `MTP` + `Vision` + `Dense Twin` + `Draft Head`, 108.6 GiB)
|
|
74
|
+
* для скачивания штатным многопоточным загрузчиком WORK прямо в метапапку модели `MODELS/Local/Qwen3.8-Flash-Next/$ai/#weights/`.
|
|
75
75
|
*/
|
|
76
|
-
export const
|
|
77
|
-
export const BUBO_ORIGINAL_MODEL_FILES = Object.freeze([
|
|
76
|
+
export const QWEN_FLASH_NEXT_GGUF_FILES = Object.freeze([
|
|
78
77
|
{
|
|
79
78
|
name: 'UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf',
|
|
80
79
|
destRelPath: 'Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf',
|
|
@@ -101,29 +100,30 @@ export const BUBO_ORIGINAL_MODEL_FILES = Object.freeze([
|
|
|
101
100
|
},
|
|
102
101
|
{
|
|
103
102
|
name: 'mtp/mtp-Qwen3.8-Flash-Next-shared-Q8_0.gguf',
|
|
104
|
-
destRelPath: 'mtp
|
|
103
|
+
destRelPath: 'mtp-Qwen3.8-Flash-Next-shared-Q8_0.gguf',
|
|
105
104
|
url: 'https://huggingface.co/unsloth/Qwen3.8-Flash-Next-GGUF/resolve/766911a6b7369840a91dbcd95f9f997acaab6cd6/MTP/mtp-Qwen3.8-Flash-Next-shared-Q8_0.gguf',
|
|
106
105
|
size: 2786568256,
|
|
107
106
|
},
|
|
108
107
|
{
|
|
109
108
|
name: 'mmproj/mmproj-Qwen3.8-Flash-Next-BF16.gguf',
|
|
110
|
-
destRelPath: 'mmproj
|
|
109
|
+
destRelPath: 'mmproj-Qwen3.8-Flash-Next-BF16.gguf',
|
|
111
110
|
url: 'https://huggingface.co/unsloth/Qwen3.8-Flash-Next-GGUF/resolve/766911a6b7369840a91dbcd95f9f997acaab6cd6/mmproj-BF16.gguf',
|
|
112
111
|
size: 907542944,
|
|
113
112
|
},
|
|
114
113
|
{
|
|
115
114
|
name: 'twin/iq4-nofullattn-nohc.gguf',
|
|
116
|
-
destRelPath: '
|
|
115
|
+
destRelPath: 'iq4-nofullattn-nohc.gguf',
|
|
117
116
|
url: 'https://huggingface.co/HaloForgeLabs/bubo-qwen3.8-flash-next/resolve/0a3c343bec2095f43f2906371c83e4faa8a47da1/twin-base/iq4-nofullattn-nohc.gguf',
|
|
118
117
|
size: 1230788768,
|
|
119
118
|
},
|
|
120
119
|
{
|
|
121
120
|
name: 'draft_head/draft-out-q4k.gguf',
|
|
122
|
-
destRelPath: '
|
|
121
|
+
destRelPath: 'draft-out-q4k.gguf',
|
|
123
122
|
url: 'https://huggingface.co/HaloForgeLabs/bubo-qwen3.8-flash-next/resolve/0a3c343bec2095f43f2906371c83e4faa8a47da1/draft_head/draft-out-q4k.gguf',
|
|
124
123
|
size: 357581248,
|
|
125
124
|
},
|
|
126
125
|
]);
|
|
126
|
+
export const BUBO_ORIGINAL_MODEL_FILES = QWEN_FLASH_NEXT_GGUF_FILES;
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* Каталог штатных моделей для машинок Halo в `/MODELS/Local` (1 основная GPU-модель + 7 NPU-моделей на одном порту 8731).
|
|
@@ -687,16 +687,15 @@ export function computeHalogenMemoryPlan({
|
|
|
687
687
|
` ${HALOGEN_IMAGE_TAG}`,
|
|
688
688
|
].join('\n');
|
|
689
689
|
|
|
690
|
-
// Нативная подготовка
|
|
690
|
+
// Нативная подготовка движка Halowin Bubo (AMD ROCm 10.0.0 gfx1151) и запуск нейросети из её метапапки `$ai/#weights`
|
|
691
691
|
const windowsPrepareCommand = [
|
|
692
|
-
`.\\bubo.exe prepare runtime --yes`,
|
|
693
|
-
`.\\bubo.exe prepare model --model-set original --output "MODELS\\Local" --yes`,
|
|
692
|
+
`.\\bubo.exe prepare runtime --runtime-dir "MODELS\\Local\\$provider\\#runtime\\bubo\\runtime\\rocm-10.0.0-gfx1151" --yes`,
|
|
694
693
|
].join('\n');
|
|
695
694
|
|
|
696
695
|
const windowsCommand = [
|
|
697
696
|
`bubo.exe serve llm ^`,
|
|
698
697
|
` --host 127.0.0.1 --port ${HALOGEN_DEFAULT_PORT} ^`,
|
|
699
|
-
` --
|
|
698
|
+
` --model "MODELS\\Local\\Qwen3.8-Flash-Next\\$ai\\#weights\\Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf" ^`,
|
|
700
699
|
` --served-model-name halogen-qwen3.8-flash-next ^`,
|
|
701
700
|
` --profile ${kvSlots > 1 ? 'subagents' : 'default'} --context ${contextTokens} ^`,
|
|
702
701
|
` --npu-prefill on ^`,
|
|
@@ -807,19 +806,9 @@ export function inspectWindowsHalogenEnvironment({ rootDir = process.cwd() } = {
|
|
|
807
806
|
].filter(Boolean);
|
|
808
807
|
const rocmRuntimeDir = rocmCandidates.find(p => fs.existsSync(p)) || null;
|
|
809
808
|
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
path.join(rootDir, 'MODELS', 'Local', 'models', 'qwen38-flash-next-base-ud-q4-k-xl-v1', 'bubo-package.json'),
|
|
814
|
-
path.join(rootDir, 'MODELS', 'Local', 'models', 'huihui-qwen38-flash-next-ud-q4-k-xl-v1', 'bubo-package.json'),
|
|
815
|
-
path.join(rootDir, 'MODELS', 'Local', 'Qwen3.8-Flash-Next', '#weights', 'bubo-package.json'),
|
|
816
|
-
path.join(rootDir, 'MODELS', 'Halogen', 'models', 'qwen38-flash-next-base-ud-q4-k-xl-v1', 'bubo-package.json'),
|
|
817
|
-
path.join(rootDir, 'MODELS', 'Halogen', 'models', 'huihui-qwen38-flash-next-ud-q4-k-xl-v1', 'bubo-package.json'),
|
|
818
|
-
path.join(rootDir, 'MODELS', 'Halogen', 'Qwen3.8-Flash-Next', '#weights', 'bubo-package.json'),
|
|
819
|
-
path.join(localAppData, 'Bubo', 'models', 'qwen38-flash-next-base-ud-q4-k-xl-v1', 'bubo-package.json'),
|
|
820
|
-
path.join(localAppData, 'Bubo', 'models', 'huihui-qwen38-flash-next-ud-q4-k-xl-v1', 'bubo-package.json'),
|
|
821
|
-
].filter(Boolean);
|
|
822
|
-
const buboManifestPath = manifestCandidates.find(p => fs.existsSync(p)) || null;
|
|
809
|
+
const flashWeightsDir = modelWeightsDir(rootDir, 'Qwen3.8-Flash-Next', 'Local');
|
|
810
|
+
const flashResolved = resolveBuboModelFiles(flashWeightsDir);
|
|
811
|
+
const anyLocalGguf = flashResolved.mainModel || findLocalGgufModel(rootDir);
|
|
823
812
|
|
|
824
813
|
const gufoCandidates = [
|
|
825
814
|
path.join(rtBase, 'gufo', 'gufo.exe'),
|
|
@@ -866,8 +855,8 @@ export function inspectWindowsHalogenEnvironment({ rootDir = process.cwd() } = {
|
|
|
866
855
|
buboRootDir,
|
|
867
856
|
rocmRuntimePrepared: Boolean(rocmRuntimeDir),
|
|
868
857
|
rocmRuntimeDir,
|
|
869
|
-
buboModelPrepared: Boolean(
|
|
870
|
-
buboManifestPath,
|
|
858
|
+
buboModelPrepared: Boolean(anyLocalGguf),
|
|
859
|
+
buboManifestPath: null,
|
|
871
860
|
gufoInstalled: Boolean(gufoExePath),
|
|
872
861
|
gufoExePath,
|
|
873
862
|
strataInstalled: Boolean(strataExePath),
|
|
@@ -1029,40 +1018,78 @@ export async function probeHalogenServer(baseUrl = HALOGEN_DEFAULT_BASE_URL, { f
|
|
|
1029
1018
|
}
|
|
1030
1019
|
|
|
1031
1020
|
/**
|
|
1032
|
-
* Найти
|
|
1021
|
+
* Найти основной шард GGUF и все вспомогательные файлы (MTP, Vision mmproj, Dense Twin, Draft Head)
|
|
1022
|
+
* внутри метапапки модели `$ai/#weights` — поддерживается как плоская раскладка, так и подпапки `mtp/`, `mmproj/`, `twin/`, `draft_head/`.
|
|
1033
1023
|
*/
|
|
1034
|
-
function
|
|
1035
|
-
const
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
if (!fs.existsSync(base))
|
|
1043
|
-
continue;
|
|
1024
|
+
export function resolveBuboModelFiles(weightsDir) {
|
|
1025
|
+
const empty = { mainModel: null, mtpModel: null, mmprojModel: null, twinModel: null, draftHeadModel: null };
|
|
1026
|
+
if (!weightsDir || !fs.existsSync(weightsDir))
|
|
1027
|
+
return empty;
|
|
1028
|
+
const candidates = [];
|
|
1029
|
+
const scanDir = (dir) => {
|
|
1030
|
+
if (!fs.existsSync(dir))
|
|
1031
|
+
return;
|
|
1044
1032
|
try {
|
|
1045
|
-
for (const
|
|
1046
|
-
if (
|
|
1047
|
-
|
|
1048
|
-
const candidates = [
|
|
1049
|
-
path.join(base, entry.name, '$ai', '#weights'),
|
|
1050
|
-
path.join(base, entry.name, '#weights'),
|
|
1051
|
-
path.join(base, entry.name),
|
|
1052
|
-
];
|
|
1053
|
-
for (const dir of candidates) {
|
|
1054
|
-
if (!fs.existsSync(dir))
|
|
1055
|
-
continue;
|
|
1056
|
-
const gguf = fs.readdirSync(dir)
|
|
1057
|
-
.filter(f => f.endsWith('.gguf') && !f.endsWith('.part') && !/mtp|mmproj/i.test(f))
|
|
1058
|
-
.sort()[0];
|
|
1059
|
-
if (gguf)
|
|
1060
|
-
return path.join(dir, gguf);
|
|
1061
|
-
}
|
|
1033
|
+
for (const ent of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
1034
|
+
if (ent.isFile() && ent.name.toLowerCase().endsWith('.gguf') && !ent.name.endsWith('.part'))
|
|
1035
|
+
candidates.push(path.join(dir, ent.name));
|
|
1062
1036
|
}
|
|
1063
1037
|
}
|
|
1064
1038
|
catch { /* ignore */ }
|
|
1039
|
+
};
|
|
1040
|
+
scanDir(weightsDir);
|
|
1041
|
+
for (const sub of ['mtp', 'mmproj', 'twin', 'draft_head'])
|
|
1042
|
+
scanDir(path.join(weightsDir, sub));
|
|
1043
|
+
|
|
1044
|
+
const isSidecar = (p) => {
|
|
1045
|
+
const base = path.basename(p).toLowerCase();
|
|
1046
|
+
const dirName = path.basename(path.dirname(p)).toLowerCase();
|
|
1047
|
+
return ['mtp', 'mmproj', 'twin', 'draft_head'].includes(dirName)
|
|
1048
|
+
|| /^(mtp[-_]|mmproj[-_]|iq4-nofullattn|twin[-_]|draft[-_]?out|draft[-_]?head)/.test(base);
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
const mainModel = candidates
|
|
1052
|
+
.filter(p => !isSidecar(p))
|
|
1053
|
+
.sort((a, b) => (/-00001-of-/i.test(a) ? -1 : /-00001-of-/i.test(b) ? 1 : a.localeCompare(b)))[0] || null;
|
|
1054
|
+
const mtpModel = candidates.find(p =>
|
|
1055
|
+
path.basename(path.dirname(p)).toLowerCase() === 'mtp' || /^mtp[-_]/i.test(path.basename(p))
|
|
1056
|
+
) || null;
|
|
1057
|
+
const mmprojModel = candidates.find(p =>
|
|
1058
|
+
path.basename(path.dirname(p)).toLowerCase() === 'mmproj' || /^mmproj[-_]/i.test(path.basename(p))
|
|
1059
|
+
) || null;
|
|
1060
|
+
const twinModel = candidates.find(p =>
|
|
1061
|
+
path.basename(path.dirname(p)).toLowerCase() === 'twin' || /iq4-nofullattn|^twin[-_]/i.test(path.basename(p))
|
|
1062
|
+
) || null;
|
|
1063
|
+
const draftHeadModel = candidates.find(p =>
|
|
1064
|
+
path.basename(path.dirname(p)).toLowerCase() === 'draft_head' || /draft[-_]?out|draft[-_]?head/i.test(path.basename(p))
|
|
1065
|
+
) || null;
|
|
1066
|
+
|
|
1067
|
+
return { mainModel, mtpModel, mmprojModel, twinModel, draftHeadModel };
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* Найти локальный GGUF-файл модели в метапапках моделей `/MODELS/Local/<Модель>/$ai/#weights`.
|
|
1072
|
+
*/
|
|
1073
|
+
function findLocalGgufModel(rootDir = process.cwd()) {
|
|
1074
|
+
const preferred = resolveBuboModelFiles(modelWeightsDir(rootDir, 'Qwen3.8-Flash-Next', 'Local'));
|
|
1075
|
+
if (preferred.mainModel)
|
|
1076
|
+
return preferred.mainModel;
|
|
1077
|
+
|
|
1078
|
+
const localRoot = path.join(rootDir, 'MODELS', 'Local');
|
|
1079
|
+
if (!fs.existsSync(localRoot))
|
|
1080
|
+
return null;
|
|
1081
|
+
try {
|
|
1082
|
+
for (const entry of fs.readdirSync(localRoot, { withFileTypes: true })) {
|
|
1083
|
+
if (!entry.isDirectory() || entry.name.startsWith('$') || entry.name.startsWith('#') || entry.name === 'models')
|
|
1084
|
+
continue;
|
|
1085
|
+
for (const dir of [modelWeightsDir(rootDir, entry.name, 'Local'), path.join(localRoot, entry.name, '#weights')]) {
|
|
1086
|
+
const resolved = resolveBuboModelFiles(dir);
|
|
1087
|
+
if (resolved.mainModel)
|
|
1088
|
+
return resolved.mainModel;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1065
1091
|
}
|
|
1092
|
+
catch { /* ignore */ }
|
|
1066
1093
|
return null;
|
|
1067
1094
|
}
|
|
1068
1095
|
|
|
@@ -1108,14 +1135,12 @@ export function checkWindowsHalogenPreflight({
|
|
|
1108
1135
|
}
|
|
1109
1136
|
|
|
1110
1137
|
/**
|
|
1111
|
-
* Скачать и подготовить нативный Windows-движок `Halowin Bubo` (`bubo-v0.1.2-windows-x64-gfx1151.zip`)
|
|
1112
|
-
* официальный рантайм AMD ROCm 10.0.0 (`gfx1151`)
|
|
1138
|
+
* Скачать и подготовить общий нативный Windows-движок `Halowin Bubo` (`bubo-v0.1.2-windows-x64-gfx1151.zip`)
|
|
1139
|
+
* и официальный рантайм AMD ROCm 10.0.0 (`gfx1151`) в `MODELS/Local/$provider/#runtime/bubo/`.
|
|
1113
1140
|
*/
|
|
1114
1141
|
export async function prepareWindowsBuboRuntime({
|
|
1115
1142
|
rootDir = process.cwd(),
|
|
1116
1143
|
step = 'runtime',
|
|
1117
|
-
modelSet = 'original',
|
|
1118
|
-
offline = false,
|
|
1119
1144
|
fetchImpl = globalThis.fetch,
|
|
1120
1145
|
spawnImpl = spawn,
|
|
1121
1146
|
} = {}) {
|
|
@@ -1123,7 +1148,6 @@ export async function prepareWindowsBuboRuntime({
|
|
|
1123
1148
|
const runtimeRoot = localRuntimeDir(rootDir);
|
|
1124
1149
|
const buboDir = path.join(runtimeRoot, 'bubo');
|
|
1125
1150
|
const rocmDir = path.join(buboDir, 'runtime', 'rocm-10.0.0-gfx1151');
|
|
1126
|
-
const modelsOutDir = path.join(rootDir, 'MODELS', 'Local');
|
|
1127
1151
|
|
|
1128
1152
|
await fsp.mkdir(runtimeRoot, { recursive: true });
|
|
1129
1153
|
|
|
@@ -1131,7 +1155,7 @@ export async function prepareWindowsBuboRuntime({
|
|
|
1131
1155
|
status: 'running',
|
|
1132
1156
|
step,
|
|
1133
1157
|
progress: 5,
|
|
1134
|
-
message: 'Проверка нативного
|
|
1158
|
+
message: 'Проверка нативного движка Halowin Bubo (gfx1151)…',
|
|
1135
1159
|
logs: [],
|
|
1136
1160
|
error: '',
|
|
1137
1161
|
updatedAt: Date.now(),
|
|
@@ -1145,22 +1169,10 @@ export async function prepareWindowsBuboRuntime({
|
|
|
1145
1169
|
if (_windowsPrepareState.logs.length > 80)
|
|
1146
1170
|
_windowsPrepareState.logs.shift();
|
|
1147
1171
|
_windowsPrepareState.message = clean;
|
|
1148
|
-
const pctMatch = clean.match(/\b(\d{1,3})%/);
|
|
1149
|
-
if (pctMatch && (step === 'model' || step === 'all')) {
|
|
1150
|
-
const pct = Math.min(99, Math.max(0, Number(pctMatch[1])));
|
|
1151
|
-
if (pct > _windowsPrepareState.progress)
|
|
1152
|
-
_windowsPrepareState.progress = pct;
|
|
1153
|
-
}
|
|
1154
1172
|
_windowsPrepareState.updatedAt = Date.now();
|
|
1155
1173
|
};
|
|
1156
1174
|
|
|
1157
1175
|
try {
|
|
1158
|
-
if (step === 'model' || step === 'all') {
|
|
1159
|
-
const freeGb = getFreeDiskSpaceGb(rootDir);
|
|
1160
|
-
if (freeGb !== null && freeGb < 118) {
|
|
1161
|
-
appendLog(`Предупреждение: на диске свободно ${freeGb} ГБ (рекомендуется ~120 ГБ для модели).`);
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
1176
|
|
|
1165
1177
|
const netCfg = loadTrainerNetworkSettings(rootDir);
|
|
1166
1178
|
const childEnv = {
|
|
@@ -1254,11 +1266,11 @@ export async function prepareWindowsBuboRuntime({
|
|
|
1254
1266
|
}
|
|
1255
1267
|
|
|
1256
1268
|
const buboExe = envInfo.buboExePath || path.join(buboDir, 'bin', 'bubo.exe');
|
|
1257
|
-
if ((step === 'runtime' || step === '
|
|
1269
|
+
if ((step === 'runtime' || step === 'all') && !fs.existsSync(buboExe)) {
|
|
1258
1270
|
throw new Error(`Исполняемый файл bubo.exe не найден по пути: ${buboExe}`);
|
|
1259
1271
|
}
|
|
1260
1272
|
|
|
1261
|
-
// Шаг 2: Установка официальных библиотек AMD ROCm 10.0.0 (`gfx1151`)
|
|
1273
|
+
// Шаг 2: Установка официальных библиотек AMD ROCm 10.0.0 (`gfx1151`) в общий #runtime/bubo/runtime/
|
|
1262
1274
|
if ((step === 'runtime' || step === 'all') && fs.existsSync(buboExe)) {
|
|
1263
1275
|
appendLog('Загрузка официальных пакетов AMD ROCm 10.0.0 для gfx1151 (bubo prepare runtime --yes)…');
|
|
1264
1276
|
_windowsPrepareState.progress = Math.max(_windowsPrepareState.progress, 35);
|
|
@@ -1279,60 +1291,6 @@ export async function prepareWindowsBuboRuntime({
|
|
|
1279
1291
|
});
|
|
1280
1292
|
}
|
|
1281
1293
|
|
|
1282
|
-
// Шаг 3: Подготовка 8 файлов модели Qwen3.8-Flash-Next (UD-Q4_K_XL + MTP + Dense Twin + Draft Head + Vision)
|
|
1283
|
-
if ((step === 'model' || step === 'all') && fs.existsSync(buboExe)) {
|
|
1284
|
-
appendLog(`Подготовка модели Qwen3.8-Flash-Next (${modelSet}${offline ? ', проверка локальных файлов' : ''}) через bubo prepare model…`);
|
|
1285
|
-
_windowsPrepareState.progress = Math.max(_windowsPrepareState.progress, 45);
|
|
1286
|
-
const args = [
|
|
1287
|
-
'prepare', 'model',
|
|
1288
|
-
...(modelSet === 'original' ? ['--model-set', 'original'] : []),
|
|
1289
|
-
...(offline ? ['--offline'] : []),
|
|
1290
|
-
'--output', modelsOutDir,
|
|
1291
|
-
'--yes',
|
|
1292
|
-
];
|
|
1293
|
-
await new Promise((resolve, reject) => {
|
|
1294
|
-
const proc = spawnImpl(buboExe, args, {
|
|
1295
|
-
cwd: path.dirname(buboExe),
|
|
1296
|
-
env: childEnv,
|
|
1297
|
-
windowsHide: true,
|
|
1298
|
-
});
|
|
1299
|
-
proc.stdout?.on('data', d => appendLog(d));
|
|
1300
|
-
proc.stderr?.on('data', d => appendLog(d));
|
|
1301
|
-
proc.on('error', reject);
|
|
1302
|
-
proc.on('close', code => code === 0 ? resolve() : reject(new Error(`bubo prepare model завершился с кодом ${code}`)));
|
|
1303
|
-
});
|
|
1304
|
-
|
|
1305
|
-
const afterEnv = inspectWindowsHalogenEnvironment({ rootDir });
|
|
1306
|
-
const flashSpec = HALOGEN_MODELS_CATALOG.find(m => m.nodeName === 'Qwen3.8-Flash-Next');
|
|
1307
|
-
if (flashSpec) {
|
|
1308
|
-
const wDir = afterEnv.buboManifestPath
|
|
1309
|
-
? path.dirname(afterEnv.buboManifestPath)
|
|
1310
|
-
: modelWeightsDir(rootDir, flashSpec.nodeName, 'Local');
|
|
1311
|
-
await registerLocalModelNode({
|
|
1312
|
-
rootDir,
|
|
1313
|
-
folderName: flashSpec.nodeName,
|
|
1314
|
-
label: flashSpec.label,
|
|
1315
|
-
repoId: flashSpec.windowsBuboRepo || 'unsloth/Qwen3.8-Flash-Next-GGUF',
|
|
1316
|
-
model: flashSpec.model,
|
|
1317
|
-
protocol: 'halogen',
|
|
1318
|
-
icon: flashSpec.icon || 'ai:qwen',
|
|
1319
|
-
modality: flashSpec.modality,
|
|
1320
|
-
capabilities: flashSpec.capabilities,
|
|
1321
|
-
efforts: flashSpec.efforts,
|
|
1322
|
-
maxTokens: flashSpec.maxTokens,
|
|
1323
|
-
maxOutput: flashSpec.maxOutput,
|
|
1324
|
-
baseUrl: flashSpec.baseUrl || HALOGEN_DEFAULT_BASE_URL,
|
|
1325
|
-
weightsDir: wDir,
|
|
1326
|
-
primaryFile: 'bubo-package.json',
|
|
1327
|
-
});
|
|
1328
|
-
try {
|
|
1329
|
-
const localNode = await globalThis.WORK?.get_item?.('/MODELS/Local');
|
|
1330
|
-
localNode?.reset?.();
|
|
1331
|
-
}
|
|
1332
|
-
catch { /* ignore */ }
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
1294
|
_windowsPrepareState.status = 'completed';
|
|
1337
1295
|
_windowsPrepareState.progress = 100;
|
|
1338
1296
|
appendLog('Нативный стек Halowin Bubo (AMD ROCm 10.0.0 gfx1151) готов к работе.');
|
|
@@ -1387,17 +1345,20 @@ export async function startHalogenBackend({
|
|
|
1387
1345
|
fs.mkdirSync(path.join(cacheDir, 'slots'), { recursive: true });
|
|
1388
1346
|
|
|
1389
1347
|
const ggufPath = modelPath || findLocalGgufModel(rootDir);
|
|
1348
|
+
const resolvedSidecars = ggufPath ? resolveBuboModelFiles(path.dirname(ggufPath)) : null;
|
|
1390
1349
|
|
|
1391
|
-
// 1. Приоритет №1 на Windows: нативный Halowin Bubo (`bubo.exe serve llm` на ROCm 10.0.0 gfx1151 + Ryzen AI NPU)
|
|
1392
|
-
if (winEnv.buboInstalled &&
|
|
1350
|
+
// 1. Приоритет №1 на Windows: нативный движок Halowin Bubo (`bubo.exe serve llm` на ROCm 10.0.0 gfx1151 + Ryzen AI NPU)
|
|
1351
|
+
if (winEnv.buboInstalled && ggufPath && fs.existsSync(ggufPath)) {
|
|
1393
1352
|
try {
|
|
1394
1353
|
const args = [
|
|
1395
1354
|
'serve', 'llm',
|
|
1396
1355
|
'--host', '127.0.0.1',
|
|
1397
1356
|
'--port', String(port),
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1357
|
+
'--model', ggufPath,
|
|
1358
|
+
...(resolvedSidecars?.mtpModel ? ['--mtp-model', resolvedSidecars.mtpModel] : []),
|
|
1359
|
+
...(resolvedSidecars?.mmprojModel ? ['--mmproj', resolvedSidecars.mmprojModel] : []),
|
|
1360
|
+
...(resolvedSidecars?.twinModel ? ['--twin-model', resolvedSidecars.twinModel] : []),
|
|
1361
|
+
...(resolvedSidecars?.draftHeadModel ? ['--draft-head-model', resolvedSidecars.draftHeadModel] : []),
|
|
1401
1362
|
'--served-model-name', 'halogen-qwen3.8-flash-next',
|
|
1402
1363
|
'--profile', profile || 'subagents',
|
|
1403
1364
|
'--cache-disk', path.join(cacheDir, 'disk'),
|
|
@@ -1421,7 +1382,7 @@ export async function startHalogenBackend({
|
|
|
1421
1382
|
_managedInfo = {
|
|
1422
1383
|
pid: proc.pid,
|
|
1423
1384
|
port,
|
|
1424
|
-
modelPath:
|
|
1385
|
+
modelPath: ggufPath,
|
|
1425
1386
|
startedAt: Date.now(),
|
|
1426
1387
|
runtime: 'bubo',
|
|
1427
1388
|
npuPrefill: Boolean(npuPrefill && winEnv.npuDriverInstalled && winEnv.npuKernelsPresent),
|
|
@@ -1436,7 +1397,7 @@ export async function startHalogenBackend({
|
|
|
1436
1397
|
runtime: 'bubo.exe (AMD ROCm 10.0.0 gfx1151)',
|
|
1437
1398
|
pid: proc.pid,
|
|
1438
1399
|
port,
|
|
1439
|
-
modelPath:
|
|
1400
|
+
modelPath: ggufPath,
|
|
1440
1401
|
windowsEnv: winEnv,
|
|
1441
1402
|
};
|
|
1442
1403
|
}
|
|
@@ -1592,7 +1553,7 @@ export async function ensureHalogenBackendRunning({
|
|
|
1592
1553
|
const wInsp = candidateWeightsDir ? inspectWeightsDirectorySync(candidateWeightsDir, platform) : null;
|
|
1593
1554
|
const winEnv = inspectWindowsHalogenEnvironment({ rootDir });
|
|
1594
1555
|
|
|
1595
|
-
if (platform === 'win32' && wInsp?.incompatibleOnPlatform
|
|
1556
|
+
if (platform === 'win32' && wInsp?.incompatibleOnPlatform) {
|
|
1596
1557
|
return {
|
|
1597
1558
|
ready: false,
|
|
1598
1559
|
code: 'INCOMPATIBLE_FORMAT',
|
|
@@ -1607,7 +1568,7 @@ export async function ensureHalogenBackendRunning({
|
|
|
1607
1568
|
_backendStartPromise = (async () => {
|
|
1608
1569
|
try {
|
|
1609
1570
|
const explicitGguf = (wInsp?.hasGguf && candidateWeightsDir)
|
|
1610
|
-
?
|
|
1571
|
+
? (resolveBuboModelFiles(candidateWeightsDir).mainModel || '')
|
|
1611
1572
|
: '';
|
|
1612
1573
|
|
|
1613
1574
|
const startRes = await startHalogenBackend({
|
|
@@ -1888,15 +1849,15 @@ export async function ensureHalogenModelNodes(rootDir = process.cwd(), { models
|
|
|
1888
1849
|
}
|
|
1889
1850
|
|
|
1890
1851
|
/**
|
|
1891
|
-
*
|
|
1892
|
-
*
|
|
1852
|
+
* Убедиться, что общий нативный Windows-движок `bubo.exe` + `ROCm 10.0.0 gfx1151`
|
|
1853
|
+
* установлен в `MODELS/Local/$provider/#runtime/bubo/` (без скачивания или копирования весов).
|
|
1893
1854
|
*/
|
|
1894
|
-
export async function
|
|
1855
|
+
export async function ensureWindowsBuboEngineInstalled({
|
|
1895
1856
|
rootDir = process.cwd(),
|
|
1896
1857
|
fetchImpl = globalThis.fetch,
|
|
1897
1858
|
spawnImpl = spawn,
|
|
1898
1859
|
} = {}) {
|
|
1899
|
-
|
|
1860
|
+
const envInfo = inspectWindowsHalogenEnvironment({ rootDir });
|
|
1900
1861
|
if (!envInfo.buboInstalled || !envInfo.rocmRuntimePrepared) {
|
|
1901
1862
|
const rtRes = await prepareWindowsBuboRuntime({
|
|
1902
1863
|
rootDir,
|
|
@@ -1907,33 +1868,9 @@ export async function finalizeWindowsBuboModel({
|
|
|
1907
1868
|
if (!rtRes.ok)
|
|
1908
1869
|
throw new Error(rtRes.error || 'Не удалось установить встроенный движок Halowin Bubo (ROCm 10.0 gfx1151)');
|
|
1909
1870
|
}
|
|
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
1871
|
return { ok: true, windowsEnv: inspectWindowsHalogenEnvironment({ rootDir }) };
|
|
1936
1872
|
}
|
|
1873
|
+
export const finalizeWindowsBuboModel = ensureWindowsBuboEngineInstalled;
|
|
1937
1874
|
|
|
1938
1875
|
/**
|
|
1939
1876
|
* Проверить наличие скачанных весов и узлов `$ai` для каждой модели Halo, совместимой с текущей ОС.
|
|
@@ -1941,7 +1878,6 @@ export async function finalizeWindowsBuboModel({
|
|
|
1941
1878
|
export function inspectHalogenCatalogWithStatus(rootDir = process.cwd(), { platform = os.platform() } = {}) {
|
|
1942
1879
|
migrateLocalModelsLayoutSync(rootDir);
|
|
1943
1880
|
const activeDownloads = listHuggingFaceDownloads(rootDir);
|
|
1944
|
-
const winEnv = platform === 'win32' ? inspectWindowsHalogenEnvironment({ rootDir }) : null;
|
|
1945
1881
|
const catalog = getHalogenCatalogForPlatform(platform);
|
|
1946
1882
|
|
|
1947
1883
|
return catalog.map(spec => {
|
|
@@ -1953,14 +1889,11 @@ export function inspectHalogenCatalogWithStatus(rootDir = process.cwd(), { platf
|
|
|
1953
1889
|
: (fs.existsSync(legacyHalogenDir) ? legacyHalogenDir : localWeightsDir));
|
|
1954
1890
|
|
|
1955
1891
|
const wInsp = inspectWeightsDirectorySync(weightsDir, platform);
|
|
1956
|
-
const hasBuboReady = platform === 'win32'
|
|
1957
|
-
&& spec.nodeName === 'Qwen3.8-Flash-Next'
|
|
1958
|
-
&& Boolean(winEnv?.buboModelPrepared && winEnv?.buboManifestPath);
|
|
1959
1892
|
|
|
1960
1893
|
const nodeConfigured = fs.existsSync(modelClassFile(rootDir, spec.nodeName, 'Local'));
|
|
1961
1894
|
let activeJob = activeDownloads.find(d =>
|
|
1962
1895
|
(d.status === 'downloading' || d.status === 'paused' || d.status === 'failed')
|
|
1963
|
-
&& (d.repoId === spec.hfRepo || d.folderName === spec.nodeName || d.modelPath === spec.path)
|
|
1896
|
+
&& (d.repoId === spec.hfRepo || (spec.windowsBuboRepo && d.repoId === spec.windowsBuboRepo) || d.folderName === spec.nodeName || d.modelPath === spec.path)
|
|
1964
1897
|
) || null;
|
|
1965
1898
|
|
|
1966
1899
|
if (!activeJob && platform === 'win32' && spec.nodeName === 'Qwen3.8-Flash-Next' && (_windowsPrepareState.status === 'running' || _windowsPrepareState.status === 'error')) {
|
|
@@ -1974,22 +1907,22 @@ export function inspectHalogenCatalogWithStatus(rootDir = process.cwd(), { platf
|
|
|
1974
1907
|
progress: _windowsPrepareState.progress || 5,
|
|
1975
1908
|
downloadedBytes: 0,
|
|
1976
1909
|
totalBytes: 0,
|
|
1977
|
-
currentFile: _windowsPrepareState.message || '
|
|
1910
|
+
currentFile: _windowsPrepareState.message || 'Установка движка Halowin Bubo…',
|
|
1978
1911
|
sourceLabel: 'Halowin Bubo (ROCm 10.0)',
|
|
1979
1912
|
speedMBs: 0,
|
|
1980
1913
|
avgSpeedMBs: 0,
|
|
1981
1914
|
};
|
|
1982
1915
|
}
|
|
1983
1916
|
|
|
1984
|
-
const weightsDownloaded =
|
|
1917
|
+
const weightsDownloaded = !activeJob && !wInsp.pendingDownload && wInsp.hasReadyWeights && !wInsp.incompatibleOnPlatform;
|
|
1985
1918
|
|
|
1986
1919
|
return {
|
|
1987
1920
|
...spec,
|
|
1988
1921
|
nodeConfigured,
|
|
1989
|
-
weightsDir: path.relative(rootDir,
|
|
1922
|
+
weightsDir: path.relative(rootDir, weightsDir).replace(/\\/g, '/'),
|
|
1990
1923
|
weightsDownloaded,
|
|
1991
|
-
incompatibleOnPlatform:
|
|
1992
|
-
incompatibleReason:
|
|
1924
|
+
incompatibleOnPlatform: wInsp.incompatibleOnPlatform,
|
|
1925
|
+
incompatibleReason: wInsp.incompatibleReason || '',
|
|
1993
1926
|
downloadedFiles: wInsp.files,
|
|
1994
1927
|
activeDownload: activeJob,
|
|
1995
1928
|
};
|
|
@@ -2048,7 +1981,7 @@ export async function downloadHalogenBundle({
|
|
|
2048
1981
|
for (const spec of targets) {
|
|
2049
1982
|
const running = existingDownloads.find(d =>
|
|
2050
1983
|
d.status === 'downloading'
|
|
2051
|
-
&& (d.repoId === spec.hfRepo || d.folderName === spec.nodeName || d.modelPath === spec.path)
|
|
1984
|
+
&& (d.repoId === spec.hfRepo || (spec.windowsBuboRepo && d.repoId === spec.windowsBuboRepo) || d.folderName === spec.nodeName || d.modelPath === spec.path)
|
|
2052
1985
|
);
|
|
2053
1986
|
if (running) {
|
|
2054
1987
|
alreadyActiveCount++;
|
|
@@ -2059,9 +1992,8 @@ export async function downloadHalogenBundle({
|
|
|
2059
1992
|
if (spec.runtimeType === 'bubo') {
|
|
2060
1993
|
const job = await startHuggingFaceDownload({
|
|
2061
1994
|
repoId: spec.windowsBuboRepo || 'unsloth/Qwen3.8-Flash-Next-GGUF',
|
|
2062
|
-
customFiles:
|
|
2063
|
-
|
|
2064
|
-
onComplete: ({ rootDir: rd }) => finalizeWindowsBuboModel({ rootDir: rd, fetchImpl }),
|
|
1995
|
+
customFiles: QWEN_FLASH_NEXT_GGUF_FILES,
|
|
1996
|
+
onComplete: ({ rootDir: rd }) => ensureWindowsBuboEngineInstalled({ rootDir: rd, fetchImpl }),
|
|
2065
1997
|
providerFolder: 'Local',
|
|
2066
1998
|
targetNodeName: spec.nodeName,
|
|
2067
1999
|
platform,
|
|
@@ -2076,7 +2008,7 @@ export async function downloadHalogenBundle({
|
|
|
2076
2008
|
maxTokens: spec.maxTokens,
|
|
2077
2009
|
maxOutput: spec.maxOutput,
|
|
2078
2010
|
baseUrl: spec.baseUrl || HALOGEN_DEFAULT_BASE_URL,
|
|
2079
|
-
primaryFile: '
|
|
2011
|
+
primaryFile: 'Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf',
|
|
2080
2012
|
},
|
|
2081
2013
|
rootDir,
|
|
2082
2014
|
token,
|
|
@@ -1943,7 +1943,8 @@ export async function resumeHuggingFaceDownload({
|
|
|
1943
1943
|
|
|
1944
1944
|
const stateHasCustomUrls = Array.isArray(state.files) && state.files.some(f => f?.url || f?.destRelPath);
|
|
1945
1945
|
const resolvedCustomFiles = customFiles ?? entry?.customFiles ?? (stateHasCustomUrls ? state.files : null);
|
|
1946
|
-
const
|
|
1946
|
+
const rawCustomDir = customFilesDir || entry?.customFilesDir || state.customFilesDir || '';
|
|
1947
|
+
const resolvedCustomDir = /^MODELS[\\/]+Local[\\/]+models([\\/]|$)/i.test(rawCustomDir) ? '' : rawCustomDir;
|
|
1947
1948
|
const stateFileNames = Array.isArray(state.files) && state.files.length
|
|
1948
1949
|
? state.files.map(f => f?.name).filter(Boolean)
|
|
1949
1950
|
: null;
|
|
@@ -65,8 +65,10 @@ import {
|
|
|
65
65
|
computeHalogenMemoryPlan,
|
|
66
66
|
inspectWindowsHalogenEnvironment,
|
|
67
67
|
prepareWindowsBuboRuntime,
|
|
68
|
+
ensureWindowsBuboEngineInstalled,
|
|
68
69
|
finalizeWindowsBuboModel,
|
|
69
|
-
|
|
70
|
+
resolveBuboModelFiles,
|
|
71
|
+
QWEN_FLASH_NEXT_GGUF_FILES,
|
|
70
72
|
BUBO_ORIGINAL_MODEL_FILES,
|
|
71
73
|
probeHalogenServer,
|
|
72
74
|
startHalogenBackend,
|
|
@@ -121,6 +123,7 @@ import {
|
|
|
121
123
|
import {
|
|
122
124
|
inspectWeightsDirectorySync,
|
|
123
125
|
modelWeightsDir,
|
|
126
|
+
migrateLocalModelsLayoutSync,
|
|
124
127
|
LINUX_ONLY_HALOGEN_EXT_RE,
|
|
125
128
|
} from './paths.js';
|
|
126
129
|
|
|
@@ -176,8 +179,10 @@ export {
|
|
|
176
179
|
computeHalogenMemoryPlan,
|
|
177
180
|
inspectWindowsHalogenEnvironment,
|
|
178
181
|
prepareWindowsBuboRuntime,
|
|
182
|
+
ensureWindowsBuboEngineInstalled,
|
|
179
183
|
finalizeWindowsBuboModel,
|
|
180
|
-
|
|
184
|
+
resolveBuboModelFiles,
|
|
185
|
+
QWEN_FLASH_NEXT_GGUF_FILES,
|
|
181
186
|
BUBO_ORIGINAL_MODEL_FILES,
|
|
182
187
|
probeHalogenServer,
|
|
183
188
|
startHalogenBackend,
|
|
@@ -376,17 +381,30 @@ export const TRAINER_METHODS = Object.freeze({
|
|
|
376
381
|
const parts = itemPath.split('/').filter(Boolean);
|
|
377
382
|
const providerId = parts[1] || 'MODELS';
|
|
378
383
|
const isLocal = providerId === 'Local' || d.protocol === 'local' || d.protocol === 'halogen';
|
|
384
|
+
if (isLocal) {
|
|
385
|
+
migrateLocalModelsLayoutSync(process.cwd());
|
|
386
|
+
}
|
|
379
387
|
const act = evaluateAiNodeActivitySync(this);
|
|
380
388
|
|
|
381
389
|
let weightInfo = null;
|
|
382
390
|
let halogenProbe = null;
|
|
383
391
|
let sizeGb = 0;
|
|
384
392
|
let needsRuntime = false;
|
|
393
|
+
let resolvedWeightsRel = d.weightsDir || '';
|
|
394
|
+
let resolvedPrimaryFile = d.primaryFile || '';
|
|
385
395
|
|
|
386
396
|
if (isLocal) {
|
|
387
|
-
const
|
|
388
|
-
const
|
|
397
|
+
const canonicalWeightsRel = path.join('MODELS', 'Local', this?.id || '', '$ai', '#weights');
|
|
398
|
+
const canonicalWeightsAbs = path.resolve(process.cwd(), canonicalWeightsRel);
|
|
399
|
+
const configuredAbs = d.weightsDir ? path.resolve(process.cwd(), d.weightsDir) : '';
|
|
400
|
+
const wDirAbs = fs.existsSync(canonicalWeightsAbs) ? canonicalWeightsAbs : (configuredAbs || canonicalWeightsAbs);
|
|
401
|
+
resolvedWeightsRel = path.relative(process.cwd(), wDirAbs).replace(/\\/g, '/');
|
|
389
402
|
weightInfo = inspectWeightsDirectorySync(wDirAbs, os.platform());
|
|
403
|
+
if (resolvedPrimaryFile === 'bubo-package.json' || (!resolvedPrimaryFile && weightInfo?.hasGguf)) {
|
|
404
|
+
const resolvedGguf = resolveBuboModelFiles(wDirAbs);
|
|
405
|
+
if (resolvedGguf.mainModel)
|
|
406
|
+
resolvedPrimaryFile = path.basename(resolvedGguf.mainModel);
|
|
407
|
+
}
|
|
390
408
|
if (weightInfo.exists) {
|
|
391
409
|
let bytes = 0;
|
|
392
410
|
for (const f of weightInfo.files) {
|
|
@@ -421,8 +439,8 @@ export const TRAINER_METHODS = Object.freeze({
|
|
|
421
439
|
maxOutput: Number(d.maxOutput || d.$public?.maxOutput) || 8192,
|
|
422
440
|
capabilities: Array.isArray(d.capabilities) ? d.capabilities : (d.$public?.capabilities || ['chat', 'stream']),
|
|
423
441
|
efforts: Array.isArray(d.efforts) ? d.efforts : [],
|
|
424
|
-
weightsDir:
|
|
425
|
-
primaryFile:
|
|
442
|
+
weightsDir: resolvedWeightsRel,
|
|
443
|
+
primaryFile: resolvedPrimaryFile,
|
|
426
444
|
enabled: d.enabled !== false,
|
|
427
445
|
aiActive: act.active,
|
|
428
446
|
aiStatusReason: act.reason,
|
|
@@ -779,9 +797,8 @@ export const TRAINER_METHODS = Object.freeze({
|
|
|
779
797
|
folderName,
|
|
780
798
|
repoId: isWinBubo ? (haloSpec?.windowsBuboRepo || 'unsloth/Qwen3.8-Flash-Next-GGUF') : (args.repoId || haloSpec?.hfRepo || ''),
|
|
781
799
|
...(isWinBubo ? {
|
|
782
|
-
customFiles:
|
|
783
|
-
|
|
784
|
-
onComplete: ({ rootDir: rd }) => finalizeWindowsBuboModel({ rootDir: rd }),
|
|
800
|
+
customFiles: QWEN_FLASH_NEXT_GGUF_FILES,
|
|
801
|
+
onComplete: ({ rootDir: rd }) => ensureWindowsBuboEngineInstalled({ rootDir: rd }),
|
|
785
802
|
} : {}),
|
|
786
803
|
quant: args.quant || 'Q8_0',
|
|
787
804
|
token: args.token || '',
|
|
@@ -796,7 +813,7 @@ export const TRAINER_METHODS = Object.freeze({
|
|
|
796
813
|
maxTokens: haloSpec.maxTokens,
|
|
797
814
|
maxOutput: haloSpec.maxOutput,
|
|
798
815
|
baseUrl: haloSpec.baseUrl ?? '',
|
|
799
|
-
...(isWinBubo ? { primaryFile: '
|
|
816
|
+
...(isWinBubo ? { primaryFile: 'Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf' } : {}),
|
|
800
817
|
} : null,
|
|
801
818
|
});
|
|
802
819
|
try {
|
|
@@ -16,6 +16,28 @@ import path from 'node:path';
|
|
|
16
16
|
|
|
17
17
|
export const WEIGHT_FILE_EXT_RE = /\.(gguf|safetensors|hgn|hnpw|bin|onnx|pt|pth)$/i;
|
|
18
18
|
export const LINUX_ONLY_HALOGEN_EXT_RE = /\.(hgn|hnpw)$/i;
|
|
19
|
+
export const WEIGHT_SIDECAR_SUBDIRS = Object.freeze(['mtp', 'mmproj', 'twin', 'draft_head']);
|
|
20
|
+
|
|
21
|
+
function collectWeightDirRawEntriesSync(dirPath) {
|
|
22
|
+
const out = [];
|
|
23
|
+
const rootEntries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
24
|
+
for (const ent of rootEntries) {
|
|
25
|
+
if (ent.isFile()) {
|
|
26
|
+
out.push(ent.name);
|
|
27
|
+
}
|
|
28
|
+
else if (ent.isDirectory() && WEIGHT_SIDECAR_SUBDIRS.includes(ent.name)) {
|
|
29
|
+
try {
|
|
30
|
+
const subEntries = fs.readdirSync(path.join(dirPath, ent.name), { withFileTypes: true });
|
|
31
|
+
for (const sub of subEntries) {
|
|
32
|
+
if (sub.isFile())
|
|
33
|
+
out.push(`${ent.name}/${sub.name}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch { /* ignore */ }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
19
41
|
|
|
20
42
|
export function localRootDir(rootDir = process.cwd()) {
|
|
21
43
|
return path.join(rootDir, 'MODELS', 'Local');
|
|
@@ -68,7 +90,7 @@ export function hasReadyWeightFilesSync(dirPath) {
|
|
|
68
90
|
if (!dirPath || !fs.existsSync(dirPath))
|
|
69
91
|
return false;
|
|
70
92
|
try {
|
|
71
|
-
return
|
|
93
|
+
return collectWeightDirRawEntriesSync(dirPath).some(f => !f.endsWith('.part') && WEIGHT_FILE_EXT_RE.test(f));
|
|
72
94
|
}
|
|
73
95
|
catch {
|
|
74
96
|
return false;
|
|
@@ -98,7 +120,7 @@ export function inspectWeightsDirectorySync(dirPath, platform = os.platform()) {
|
|
|
98
120
|
if (!dirPath || !fs.existsSync(dirPath))
|
|
99
121
|
return empty;
|
|
100
122
|
try {
|
|
101
|
-
const raw =
|
|
123
|
+
const raw = collectWeightDirRawEntriesSync(dirPath);
|
|
102
124
|
const hasParts = raw.some(f => f.endsWith('.part'));
|
|
103
125
|
let pendingState = false;
|
|
104
126
|
if (raw.includes('download-state.json')) {
|
|
@@ -330,7 +352,23 @@ export function migrateLocalModelsLayoutSync(rootDir = process.cwd(), { skipMode
|
|
|
330
352
|
catch { /* ignore */ }
|
|
331
353
|
}
|
|
332
354
|
|
|
333
|
-
//
|
|
355
|
+
// 2.5. Перенос весов из ошибочной папки v1.0.32 `MODELS/Local/models/qwen38-*` в `MODELS/Local/Qwen3.8-Flash-Next/$ai/#weights`
|
|
356
|
+
const legacyModelsDir = path.join(localRoot, 'models');
|
|
357
|
+
if (fs.existsSync(legacyModelsDir) && !(skipModels && skipModels.has('Qwen3.8-Flash-Next'))) {
|
|
358
|
+
try {
|
|
359
|
+
const flashWeightsDir = modelWeightsDir(rootDir, 'Qwen3.8-Flash-Next');
|
|
360
|
+
for (const pkgName of ['qwen38-flash-next-base-ud-q4-k-xl-v1', 'huihui-qwen38-flash-next-ud-q4-k-xl-v1']) {
|
|
361
|
+
const pkgDir = path.join(legacyModelsDir, pkgName);
|
|
362
|
+
if (fs.existsSync(pkgDir))
|
|
363
|
+
mergeMoveDirSync(pkgDir, flashWeightsDir);
|
|
364
|
+
}
|
|
365
|
+
if (fs.existsSync(legacyModelsDir) && !fs.readdirSync(legacyModelsDir).length)
|
|
366
|
+
fs.rmdirSync(legacyModelsDir);
|
|
367
|
+
}
|
|
368
|
+
catch { /* ignore */ }
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// 3. Папки моделей со старым #weights на уровне модели (рядом с $ai) переносим в $ai/#weights и чиним пути в class.js
|
|
334
372
|
try {
|
|
335
373
|
const entries = fs.readdirSync(localRoot, { withFileTypes: true });
|
|
336
374
|
for (const e of entries) {
|
|
@@ -352,10 +390,20 @@ export function migrateLocalModelsLayoutSync(rootDir = process.cwd(), { skipMode
|
|
|
352
390
|
const meta = JSON.parse(jsonPart);
|
|
353
391
|
let changed = false;
|
|
354
392
|
const expectedWeightsRel = path.relative(rootDir, newWeights).replace(/\\/g, '/');
|
|
355
|
-
if (meta.weightsDir &&
|
|
393
|
+
if (meta.weightsDir && meta.weightsDir !== expectedWeightsRel && fs.existsSync(newWeights)) {
|
|
356
394
|
meta.weightsDir = expectedWeightsRel;
|
|
357
395
|
changed = true;
|
|
358
396
|
}
|
|
397
|
+
if (meta.primaryFile === 'bubo-package.json' && fs.existsSync(newWeights)) {
|
|
398
|
+
const wFiles = collectWeightDirRawEntriesSync(newWeights);
|
|
399
|
+
const primaryGguf = wFiles
|
|
400
|
+
.filter(f => f.toLowerCase().endsWith('.gguf') && !f.endsWith('.part') && !/^(mtp|mmproj|twin|draft|iq4-nofullattn)/i.test(path.basename(f)))
|
|
401
|
+
.sort((a, b) => (/-00001-of-/i.test(a) ? -1 : /-00001-of-/i.test(b) ? 1 : a.localeCompare(b)))[0];
|
|
402
|
+
if (primaryGguf) {
|
|
403
|
+
meta.primaryFile = path.basename(primaryGguf);
|
|
404
|
+
changed = true;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
359
407
|
if (meta.adapterPath && !meta.adapterPath.includes('/$provider/#adapters/')) {
|
|
360
408
|
const adName = path.basename(String(meta.adapterPath));
|
|
361
409
|
const newAdPath = path.join(localAdaptersDir(rootDir), adName);
|
|
@@ -865,9 +865,6 @@ export function evaluateAiNodeActivitySync(item, rootDir = process.cwd()) {
|
|
|
865
865
|
// 1. Локальный провайдер /MODELS/Local и его модели
|
|
866
866
|
if (providerId === 'Local' || data.protocol === 'local' || data.protocol === 'halogen') {
|
|
867
867
|
const platform = os.platform();
|
|
868
|
-
const buboManifest1 = path.join(rootDir, 'MODELS', 'Local', 'models', 'qwen38-flash-next-base-ud-q4-k-xl-v1', 'bubo-package.json');
|
|
869
|
-
const buboManifest2 = path.join(rootDir, 'MODELS', 'Local', 'models', 'huihui-qwen38-flash-next-ud-q4-k-xl-v1', 'bubo-package.json');
|
|
870
|
-
const hasBuboGlobal = fs.existsSync(buboManifest1) || fs.existsSync(buboManifest2);
|
|
871
868
|
|
|
872
869
|
if (type === '$provider') {
|
|
873
870
|
const localDir = path.join(rootDir, 'MODELS', 'Local');
|
|
@@ -888,8 +885,8 @@ export function evaluateAiNodeActivitySync(item, rootDir = process.cwd()) {
|
|
|
888
885
|
}
|
|
889
886
|
}
|
|
890
887
|
catch { /* ignore */ }
|
|
891
|
-
if (installedCount > 0
|
|
892
|
-
return { active: true, reason: `Активен (моделей: ${installedCount
|
|
888
|
+
if (installedCount > 0) {
|
|
889
|
+
return { active: true, reason: `Активен (моделей: ${installedCount})`, configuredKey: true };
|
|
893
890
|
}
|
|
894
891
|
return { active: false, reason: 'Нет совместимых скачанных локальных моделей (откройте для установки)', configuredKey: false };
|
|
895
892
|
}
|
|
@@ -899,7 +896,6 @@ export function evaluateAiNodeActivitySync(item, rootDir = process.cwd()) {
|
|
|
899
896
|
const canonicalWeightsRel = path.join('MODELS', 'Local', modelName, '$ai', '#weights');
|
|
900
897
|
const legacyWeightsRel = path.join('MODELS', 'Local', modelName, '#weights');
|
|
901
898
|
const adapterRel = data.adapterPath || path.join('MODELS', 'Local', '$provider', '#adapters', modelName);
|
|
902
|
-
const isFlashNext = modelName === 'Qwen3.8-Flash-Next';
|
|
903
899
|
|
|
904
900
|
const check = inspectDirCandidatesSync([
|
|
905
901
|
data.weightsDir ? path.resolve(rootDir, data.weightsDir) : '',
|
|
@@ -909,7 +905,7 @@ export function evaluateAiNodeActivitySync(item, rootDir = process.cwd()) {
|
|
|
909
905
|
], platform);
|
|
910
906
|
|
|
911
907
|
const isHalogenLinuxRepo = /^peonist-ai\/halogen-/i.test(String(data.hfRepo || ''));
|
|
912
|
-
if (platform === 'win32' && isHalogenLinuxRepo && !
|
|
908
|
+
if (platform === 'win32' && isHalogenLinuxRepo && !check.info?.hasGguf && !check.info?.hasBuboManifest) {
|
|
913
909
|
return {
|
|
914
910
|
active: false,
|
|
915
911
|
reason: check.info?.incompatibleReason || 'Веса формата Linux (.hgn/.hnpw) несовместимы с Windows',
|
|
@@ -917,7 +913,7 @@ export function evaluateAiNodeActivitySync(item, rootDir = process.cwd()) {
|
|
|
917
913
|
configuredKey: false,
|
|
918
914
|
};
|
|
919
915
|
}
|
|
920
|
-
if (check.ready
|
|
916
|
+
if (check.ready) {
|
|
921
917
|
return { active: true, reason: 'Активна (веса модели на диске)', configuredKey: true };
|
|
922
918
|
}
|
|
923
919
|
if (check.incompatible) {
|
|
@@ -410,13 +410,9 @@ export async function listLocalModelsAndAdapters(rootDir = process.cwd()) {
|
|
|
410
410
|
}
|
|
411
411
|
|
|
412
412
|
const isAdapterNode = Boolean(meta.adapterPath);
|
|
413
|
-
const hasBuboExternal = e.name === 'Qwen3.8-Flash-Next' && (
|
|
414
|
-
fs.existsSync(path.join(localRoot, 'models', 'qwen38-flash-next-base-ud-q4-k-xl-v1', 'bubo-package.json'))
|
|
415
|
-
|| fs.existsSync(path.join(localRoot, 'models', 'huihui-qwen38-flash-next-ud-q4-k-xl-v1', 'bubo-package.json'))
|
|
416
|
-
);
|
|
417
413
|
|
|
418
414
|
// Если папка модели пустая (ни готовых весов, ни незавершённой загрузки, ни адаптера) — убираем мусор
|
|
419
|
-
if (!isDownloading && !hasPendingDownload && !hasRealWeightBinary && !isAdapterNode
|
|
415
|
+
if (!isDownloading && !hasPendingDownload && !hasRealWeightBinary && !isAdapterNode) {
|
|
420
416
|
try {
|
|
421
417
|
await fsp.rm(path.join(localRoot, e.name), { recursive: true, force: true });
|
|
422
418
|
}
|
|
@@ -429,10 +425,10 @@ export async function listLocalModelsAndAdapters(rootDir = process.cwd()) {
|
|
|
429
425
|
continue;
|
|
430
426
|
}
|
|
431
427
|
|
|
432
|
-
if (hasRealWeightBinary || isAdapterNode
|
|
428
|
+
if (hasRealWeightBinary || isAdapterNode) {
|
|
433
429
|
const enabled = meta.enabled !== false;
|
|
434
430
|
const isHalogenLinuxRepo = platform === 'win32' && /^peonist-ai\/halogen-/i.test(String(meta.hfRepo || ''));
|
|
435
|
-
const incompatible =
|
|
431
|
+
const incompatible = wInsp.incompatibleOnPlatform || (isHalogenLinuxRepo && !wInsp.hasGguf && !wInsp.hasBuboManifest);
|
|
436
432
|
const incompatibleReason = wInsp.incompatibleReason || (incompatible ? 'Веса формата Linux (.hgn/.hnpw) несовместимы с Windows. Удалите их и установите Windows-версию.' : '');
|
|
437
433
|
models.push({
|
|
438
434
|
id: e.name,
|
|
@@ -444,10 +440,10 @@ export async function listLocalModelsAndAdapters(rootDir = process.cwd()) {
|
|
|
444
440
|
capabilities: Array.isArray(meta.capabilities) ? meta.capabilities : ['chat', 'stream'],
|
|
445
441
|
maxTokens: meta.maxTokens || 16384,
|
|
446
442
|
enabled,
|
|
447
|
-
active: enabled && (hasRealWeightBinary || isAdapterNode
|
|
443
|
+
active: enabled && (hasRealWeightBinary || isAdapterNode) && !incompatible,
|
|
448
444
|
incompatibleOnPlatform: incompatible,
|
|
449
445
|
incompatibleReason: incompatible ? incompatibleReason : '',
|
|
450
|
-
weightFormat:
|
|
446
|
+
weightFormat: wInsp.weightFormat,
|
|
451
447
|
path: `/MODELS/Local/${e.name}`,
|
|
452
448
|
hasClass: fs.existsSync(aiClassFile),
|
|
453
449
|
weightFiles,
|