Repository navigation
fix(llm): size model downloads from Lemonade's catalog and model cache - #4297
Conversation
Before auto-downloading a model, GAIA now checks free space in Lemonade's own model cache against the catalog's real download size, instead of a name-based guess against whatever disk the command ran from. Gemma-4-E4B was estimated at 2.5 GB against a real 5.56 GB, so a nearly full drive could pass the check and run out mid-download, while a roomy remote server could be refused. - get_model_info queries /models?show_all=true (undownloaded models are absent otherwise) and reads the `size` field; catalog errors now raise. - The disk check reads /system-info model_storage.free_bytes and raises when the server doesn't report it, instead of warning and continuing. - The first-run "Downloading model" banner uses show_all, so it can fire. - check_model_loaded asks /health, so a model that is only downloaded (or a substring of a loaded one) no longer counts as loaded. Fixes amd#4214
|
Verdict: Approve with suggestions This replaces two guesses with facts: the download size now comes from Lemonade's own catalog instead of a name-based estimate, and free space is checked on the server's model cache instead of whatever disk the command happened to run from. "Is this model loaded?" also stops meaning "is it on disk", which is what made Two things worth attention before merge:
Also note this makes auto-download hard-fail against any Lemonade that doesn't report its model-cache free space. That's the right call under the fail-loudly rule, but the error should name the version a user needs. Real-world evidenceNo What's not shown is the user-facing surface: the first-run 🔍 Technical detailsIssues🟡 Integration test compares un-normalized model names (
(needs 🟡 C++ client still equates "downloaded" with "loaded" (
🟢 Name the required Lemonade version in the
🟢 Hardware-advisor loop now refetches the whole catalog once per model (
Strengths
|
Before auto-downloading a model, GAIA guessed its size from the name and checked free space on whatever disk the command ran from. Gemma-4-E4B was estimated at 2.5 GB against a real 5.56 GB, so a nearly full drive could pass and run out mid-download, while a remote server with room could be refused. Now the check uses the catalog's real size and Lemonade's own model-cache free space, and fails loudly if the server doesn't report it. The first-run "Downloading model… several minutes" banner can now actually appear, and
gaia initstops unloading models that were only downloaded, never loaded.Overlaps textually with #3669, which touches the old
exceptincheck_model_loaded. This PR replaces that body, so whichever lands second needs a small rebase.Test plan
python -m pytest tests/unit/test_lemonade_predownload_checks.py -q: 12 pass. Onorigin/main, 10 fail and 2 pass (the 2 passing are control cases).LEMONADE_BASE_URL=<live server> python -m pytest tests/integration/test_lemonade_predownload_checks.py -v: 3 pass against a live Lemonade 11.8.1. All 3 fail onorigin/main.test_lemonade_ctx_ceiling,test_lemonade_model_loading,test_lemonade_manager_preload,test_llamacpp_backend,test_init_command,tests/unit/installer,test_hardware_advisor_agent, …): 682 pass. The 2test_uninstall_commandfailures also fail onorigin/main.tests/test_lemonade_client.py -k Mock: the same 11 tests fail before and after this change (pre-existing on this machine).Fixes #4214