mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4888] [TUI] strata models explain: show why a model folder is or is not found under models/ #5239
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5239
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4888
Author: @XiaoBinGan
Created: 11/1/2026
Status: 🔄 Open
Base:
main← Head:feat/models-explain📝 Commits (1)
f816be6[TUI] strata models explain: show why a model folder is or is not found under models/📊 Changes
6 files changed (+320 additions, -18 deletions)
View changed files
📝
docs/TERMINAL.md(+2 -1)📝
docs/TERMINAL_LAUNCH.md(+7 -0)📝
strata_cli/cli.py(+57 -1)📝
strata_cli/launch/catalog.py(+64 -13)📝
strata_control/discovery.py(+6 -3)➕
tests/terminal/test_models_explain.py(+184 -0)📄 Description
Problem and result
0.2.7 fixed #3996 by resolving a model's folder with a chain: setup's own spelling (
models/IQ3_S), then the lower-case run-config tag (models/iq3_s), then a folder that differs only in letter case, and a fallback to setup's spelling. The fix is right, but when a model still shows as "not on this computer" there is no command that says what the launch looked for and why it did not find the folder — the person sees "about X GB to download" and has to guess folder names inside the data folder.This adds
strata models explain NAME, a read-only subcommand that shows the whole decision:Nothing found, so it names the folders that are there instead:
--output json(and the--jsonalias, like the othermodelscommands) returns the same report as data. This Windows checkout's NTFS is case-insensitive, so both candidate paths open the same folder there; on a case-sensitive disk the second one isexists: no(the tests make that disk):The reason is one of
exact spelling,lower-case tag,case-insensitive matchorfallback; the parsed family/model/tag and the data folder are in the report as well. The name is resolved with the sameCatalog.resolve()the launch uses, soIQ3_S,iq3_s,--family qwenand thefamily/modelspelling used by the model table (qwen/IQ3_S) all work.Related discussion
#3996 is the case-sensitive-disk report whose fix (in 0.2.7) added the folder chain; it is closed, so the scope for this diagnostic was posted in #4887. No default path changes: new subcommand only.
Approach
Catalog.model_folder()keeps its exact rules but now shares them with a module-level_pick_model_folder()(the same two candidate folders in the same order, the same case-insensitive match, the same fallback). The report and the launch walk the same rule, so they cannot drift; the five existing tests intests/terminal/test_model_folder_case.pypass unchanged.Catalog.explain_model(base, family, model)builds the report. It lists the data folder, counts*.gguffiles and reads their sizes;nearby_foldersis at most 8 names ranked bydifflibsimilarity, names only.strata_cli/cli.pyadds theexplainsubcommand aftermovein themodelsgroup, with human lines and--output json/--json,--familyand--data-dir(default: the resolved data folder). The default base comes fromdata_dir_choice(sync=False), so it does not sync the Terminal/app data-folder settings files; every existing caller keeps the old default (sync=True).docs/TERMINAL.mdand a short paragraph indocs/TERMINAL_LAUNCH.md(the section that already explains where the launch looks for models).Validation
Environment: Windows 10 19045 (AMD64), Python 3.11.16, source checkout at
c62d5e3aplus this change.Passed:
python -m pytest tests/terminal/test_models_explain.py -q→9 passed in 0.44s. The new tests (temp directories;Path.is_dirpatched to answer from the names the folder really lists, the same technique the existing #3996 test uses) cover: setup'smodels/IQ3_Swith two fake.ggufshards counted (1000 + 250 bytes, anotes.txtnot counted); a lower-casemodels/iq3_s; a case-insensitivemodels/Iq3_S; the fallback with the closest folder names; the CLI JSON foriq3_sandqwen/IQ3_S; the human output; an unknown name refused with the closest models; and that the data folder and the other settings file are not written.Passed:
python -m pytest tests/terminal/test_models_explain.py tests/terminal/test_model_folder_case.py tests/terminal/test_tui2_023_plan.py -q→23 passed in 1.16s.Passed:
python -m pytest tests/terminal/test_tui2_023_plan.py -q→9 passed in 0.82s, andpython -m pytest tests/terminal/test_model_folder_case.py -q→5 passed in 0.15s, both the same as a pristineorigin/mainworktree.Passed: A/B on the two behaviours the change depends on. With the case-insensitive match removed, the new "differs only in letter case" test and the existing
test_model_folder_case.pycase both fail. Withdata_dir_choice()called withoutsync=False(the previous behaviour), the read-only settings test fails because the older settings file is rewritten with the newer folder.Failed: the wider launch/model subset has pre-existing failures on this Windows checkout, identical on a pristine
origin/mainworktree:python -m pytest tests/terminal/test_launch.py tests/terminal/test_shared_models_folder.py tests/terminal/test_models.py tests/terminal/test_model_folder_case.py tests/terminal/test_models_explain.py tests/terminal/test_tui2_023_plan.py -q→ this change:62 failed, 144 passed, 1 skipped; pristineorigin/mainwithout the new test file:62 failed, 135 passed, 1 skipped(the 9 extra passes are the new tests). The 62 failing test names are identical in both runs (compared withCompare-Object; no output).Not run: the full
tests/terminalsuite. Collection stops on optional packages this environment does not have (rich, ...): 11 errors on a pristineorigin/mainworktree as well. The curated subset above is what was run.Not run: a real multi-GB downloaded model on a real btrfs (case-sensitive) disk. The case-sensitive cases are covered by the
Path.is_dirpatch, not by a case-sensitive filesystem.Limits
data_dir_for);explaindoes not read installed configs.*.ggufin the chosen folder is counted. The download plan (modelstate.assess) also skips names starting withmmproj; a folder that holds only anmmprojfile would show as shards here and as 0 GB in the plan.nearby_foldersis a similarity hint (at most 8 names), not a match; it reads only directory names.mkdir exist_ok). The command writes no settings, run configs or model files; with--data-dirit creates no folder either.reasonvalues and the JSON keys are the contract; a later change to them would be a compatibility change to state in a PR.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.