改动 / #3528

#3528 [Engine] launcher: resolve the data folder past repeated models dirs

open · @woodsonl · 0 评论 · 去 GitHub 看

Setup & installServer & APIAMD / HIPNVIDIA / CUDAModels & quantsLinux

说明

[Engine] launcher: resolve the data folder past repeated models dirs

**Problem and result:** On the reporting machine the data folder nested one `models` level per newly installed model variant, reaching `Strata-data/models/models/models/…` about 200 levels deep (path excerpt below). With the layout nested, `data_dir_of()` and `prepared_beside()` resolved the inner `models` dir as the data folder, so every preset launch of a buried model failed with "The model could not be installed", `strata models list` reported every variant `missing_or_invalid`, and new installs downloaded one level deeper still. After the fix, both functions climb to the outer data folder: the nest stops growing, buried models validate again, and flat layouts resolve exactly as before.

**Environment:** Strata 0.2.0-beta, Terminal build 0.1.45.3 (engine 0.1.45.3-linux-x86_64-cuda-cuda13, python 3.12.15); Ubuntu, kernel 7.0.0-38-generic; NVIDIA GeForce RTX 4080 SUPER 16 GB; models Qwen3.8-Flash-Next NVFP4 (Maximilian228 repo) and Coder IQ1_M (GSQ-RCO, 2-file GGUF); LAN access mode; variants installed over several sessions: IQ1_M 128K, IQ1_M 128K (second), IQ1_M 256K, NVFP4 128K, NVFP4 256K.

**Observed evidence (verbatim, paths trimmed at the repeated segment):**
`/home/<user>/.local/share/strata/Strata-data/models/models/models/…/coder-IQ1_M/Qwen3.8-Flash-Next-GSQ-RCO-IQ1_M-00001-of-00002.gguf` — the `find` over the data folder counted the chain at ~200 `models` levels; the serving config for one profile pointed at `…/Strata-data/models/Maximilian228--Qwen3.8-Flash-Next-NVIDIA-NVFP4-Strata/pack`, which no longer existed at that path. `strata models list` printed all three variants `missing_or_invalid`. Each new-variant install added exactly one level (five installs over two sessions).

**Reproduce:** Not reproduced from clean. Attempts with an isolated `--data-dir` and `--model-path` pointing at existing files did not nest: two consecutive `strata launch --model-path <dir> --data-dir /tmp/t --access lan --port 8090 --api-key K --yes --no-tui` runs from different working directories produced a single `models` level both times (commands verbatim above in this session). What is unit-proven on the attached tests: once one duplicate level exists, the old `data_dir_of()` returns the inner `models` dir as the data folder (`NestedModelsDirs::test_data_dir_of_resolves_to_the_outer_data_folder` fails on the old code, passes on the new), and the next install then downloads one level deeper. The first duplicate's origin is unconfirmed; suspected in the installer's data-folder resolution when a previous install's weights sit nested.

**Expected:** the data folder for an installed model is the folder holding the outermost `models` dir; installs reuse it.
**Actual (old code):** the innermost `models` dir is returned as the data folder; installs nest one level per new variant; buried presets fail install validation.

**Approach:** in `data_dir_of()` and `prepared_beside()`, climb past consecutive `models`-named ancestors before returning `parent.parent`. `prepared_beside` additionally searches every `models` dir of the chain for `mmproj*.gguf` so existing nested installs keep finding the picture reader. Flat layouts resolve exactly as before; no caller changes.

**Recovery applied on the reporting machine (all verified):**
`mv <deep>/coder-IQ1_M <data>/coder-IQ1_M` (same filesystem, instant), remove the now-empty nest, `strata models list` flips to `present`, relaunch with the preset, serve verified end to end.

**Validation:**
Passed: `python3.11 -m pytest tests/terminal/test_discovery.py -q` → 23 passed (4 new: nested and flat for `data_dir_of` and `prepared_beside`), revision be55ec3, macOS 15, Python 3.11.17, no GPU needed (pure path logic).
Passed (live): after recovery and on the deployed patch (installed Terminal 0.1.45.3 on the reporting machine, Linux/CUDA), `strata models list` → `coder-iq1_m present`, server restart serves with the configured API key, one chat completion verified end to end.
Failed: 2 pre-existing failures in the same file on clean HEAD (`GuiLayout::test_an_own_setting_beats_the_apps_folder`, `GuiLayout::test_a_remembered_older_install_and_the_app_install_are_both_listed`). Reproduced with the change stashed; unrelated to this fix (own-setting resolution ordering in the test environment).
Not run: CUDA/HIP/SYCL builds (no engine or C++ change; strata_control/serve Python only). Re-download of the NVFP4 files deleted during manual cleanup (the preset resumes it).

**Limits:** a pathological chain made only of `models` dirs up to the filesystem root now resolves to `/`; every real install chain terminates at a `Strata-data` folder. The first duplicate level's origin is unconfirmed (see Reproduce).

本站相关内容

相关页面的快捷入口。