Repository navigation
Studio: choose the Engram table precision for Qwen3.8-Flash-Next and DeepSeek-V4.1 GGUFs - #17641
Conversation
…DeepSeek-V4.1 GGUFs
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…esumes on the chosen table
… checks and deletes
…able as no choice
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8d38da701
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| or _is_imatrix_filename(name) | ||
| ) | ||
| ) | ||
| or engram_table_precision(name) is not None, |
There was a problem hiding this comment.
Preserve tables used by quants in other cache roots
When a quant in cache B reuses cache A's standalone table through _download_engram_table(), deleting A's last local quant reaches this cleanup because _has_remaining_main_gguf(target_repo) only inspects A. This unlinks the shared table and its blob even though B's backbone remains cached. Since B intentionally skipped its bundled table shard, deleting an unrelated quant makes B unloadable offline and forces another table download online. Check remaining dependencies across remembered cache roots before reclaiming standalone tables.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this. It needs a quant in one cache root that reuses a table cached in a different root, which only happens after the cache location changes. Deletion keeps the per-repo-folder rule that every other companion file follows.
| if skip_shard and skip_shard in gguf_extra_shards: | ||
| gguf_extra_shards = [shard for shard in gguf_extra_shards if shard != skip_shard] |
There was a problem hiding this comment.
Exclude skipped table shards from the saved-KV identity
With keep-KV enabled, Engram downloads that omit the bundled shard cannot preserve their resident KV cache. _gguf_file_identity() still stats every numbered file in the original split, so the omitted shard makes it return None; save_slots_for_resume() then immediately returns without saving. Adding the external table to _slot_launch_fingerprint() only addresses launches where the original shard is also present. Build the GGUF identity from the files the Engram launch actually reads so shard-skipped downloads retain the existing KV-preservation behavior.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not a correctness bug. With the table shard absent, _gguf_file_identity returns None and save_slots_for_resume declines, so stale KV is never restored and the load starts cold. Keeping KV across reloads for these sets would be an enhancement.
|
|
…past unreadable cache roots
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54f3bc2419
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # The table is one of this download's own weights, so a partial of it is purged like the | ||
| # shards' before a transport resumes. The shard's hash stays: dropping it would let a | ||
| # stale-copy reclaim treat a cached built-in table as foreign. | ||
| main_hashes = self.main_hashes | ({table.sha256} if table.sha256 else set()), |
There was a problem hiding this comment.
Track shared Engram-table transport independently of the quant
With resumable .incomplete files and two quants selecting the same table, an HTTP attempt for quant A followed by a cancelled Xet attempt for quant B leaves A's per-variant transport marker set to HTTP. On A's next HTTP retry, prepare_cache_for_transport() retains B's sparse table partial because this hash is only in main_hashes; the size-only verification can then accept corrupted table weights. Track the table's writer with shared transport provenance, as is already done for companions, and reconstruct that ownership on manifest resumes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this. It needs two different quants that share one table, downloaded alternately over HTTP and a cancelled Xet attempt, and then an HTTP retry of the first. A table is purged like a main shard whenever its own job switches transport, which covers the reachable cases.
| engram_swap = _resolve_engram_swap( | ||
| engram_repo, hf_variant, hf_token, engram_precision |
There was a problem hiding this comment.
Preserve the request token for cached-path Engram loads
For a cached-path load of a private or gated Hub repo without an ambient token, this passes None to _resolve_engram_swap() even when the request supplies a valid hf_token: _gguf_request_intent() only copies that field when source.hf_repo is set. Recovering just engram_repo therefore makes model_info() fail with RepositoryNotFoundError or GatedRepoError, which is rethrown before consulting the cached table. A fully cached, authorized model consequently fails to reload solely because it is addressed by its cached path. Preserve the request token when recovering cached Hub provenance.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this. Only the two public unsloth repos publish standalone Engram tables, so a private or gated repo with tables that is loaded by its cache path does not occur.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54f3bc2419
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| downloaded = _is_fully_downloaded(v) and not is_partial | ||
| engram_ready = _engram_ready(requirement, downloaded) | ||
| # A quant whose own table shard was skipped for a cached standalone table is on disk too. | ||
| downloaded = downloaded or (bool(engram_ready) and not is_partial) |
There was a problem hiding this comment.
Exclude unused bundled-table partials from readiness
With resumable HTTP partials, canceling a normal download during its bundled-table shard and then completing the same quant over HTTP with another Engram table leaves the unused bundled .incomplete file cached: prepare_cache_for_transport() preserves same-transport resumable partials. The partial scan above still checks the unswapped requirement.main_hashes, so that leftover sets is_partial even though _engram_ready() confirms the complete backbone and external table. This gate consequently reports downloaded=false, partial=true; after refreshing, the picker offers another download/resume for a completed model, and retrying the same swapped plan cannot clear the flag because it never fetches that shard. Exclude unused bundled-table partials from this verdict when an Engram-ready set is present.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this. The quant still loads with its saved table, and the partial flag is accurate: a resumable partial of the quant's own table shard is still on disk, and switching back to the built-in table resumes it. Hiding the flag would hide that disk use rather than fix anything.
|
@codex review |
|
One more red on the latest run, The test locates the GPU-selection |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edcc1a308a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| with _hf_offline_if_unreachable(): | ||
| engram_swap = _resolve_engram_swap( | ||
| engram_repo, hf_variant, hf_token, engram_precision | ||
| ) |
There was a problem hiding this comment.
Validate Engram choices before unloading other inference backends
When /api/inference/load receives an unpublished Engram precision while a Transformers or NPU model is resident, this validation is too late: routes/inference.py:19886–19899 unloads those runtimes before _run_gguf_load_attempt() reaches load_model(). _resolve_engram_swap() then raises, leaving the previously healthy model unloaded even though the request could have been rejected without a teardown. Run the Engram preflight before the route’s cross-backend unload, rather than only before llama.cpp’s own teardown.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this: the UI and unsloth run --engram only offer published tables, so an unpublished precision needs a hand-written API call, and it then ends like any other GGUF load that fails after the cross-backend switch (download error, OOM): the old runtime was going to be replaced by this load anyway.
| tables = engram_tables(sizes.items()) | ||
| table = find_engram_table(tables, precision) | ||
| if table is None: |
There was a problem hiding this comment.
Allow offline loads that explicitly name the built-in table
When a normal download has cached all UD-IQ1_S shards of unsloth/Qwen3.8-Flash-Next-GGUF but no standalone tables, a load with engram_precision="IQ4_NL" correctly becomes a no-op online. Repeating the identical request offline uses cached_sizes(), so tables is empty and this branch raises before recognizing the bundled IQ4_NL table. The model is fully present and needs no download, yet explicitly naming its built-in precision makes it unloadable offline. Recognize that precision from cached quant metadata before requiring a standalone copy.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this: the UI stores the built-in table as no choice, so this needs an explicit offline --engram <built-in>; the refusal names the cached tables and dropping --engram loads the quant. Inferring the precision from tensor types offline is not worth the extra path.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edcc1a308a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| free_bytes = shutil.disk_usage(cache_dir).free | ||
| if table.size_bytes > free_bytes: |
There was a problem hiding this comment.
Credit resumable table bytes in the disk-space preflight
For HTTP caches that support partial resumes, retrying a load after an interrupted table download can fail despite sufficient disk space. For example, a 38.4 GB Q5_1 table with 30 GB already in .incomplete needs only 8.4 GB more, but this check rejects it with 10 GB free before hf_hub_download_with_xet_fallback() can resume. The user must unnecessarily free additional space or delete the partial and restart the download. Credit validated resumable bytes in the selected cache root, as the download worker's _preflight_disk_space() already does.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this: it matches the in-process GGUF shard preflight on main (_download_gguf credits only whole cached blobs, not .incomplete bytes), and it needs an interrupted table download plus a disk with less free space than the whole table. Freeing the space or using the Hub download (which credits partials) both work.
Problem: The Qwen3.8-Flash-Next and DeepSeek-V4.1-Flash-1017 guides let people swap the Engram table for another precision, but only by hand: download
engram/*-engram-<PRECISION>.gguf_file, stamp it withset_split.py, and rename it over one of the quant's files. Studio had no way to do this.Change: A new "Engram Table" setting picks the table per model and quant. Studio downloads the chosen table, skips the quant's own table when it is not on disk yet, and starts llama-server with
--ple <table>.Status: Tested live on Qwen3.8-Flash-Next UD-IQ1_S. DeepSeek was checked against its Hub listing only (its smallest quant is 233 GB).
Before and after
The second image is this PR only: main has no counterpart.
How it works
--ple(feat: external PLE file loading ggml-org/llama.cpp#31185), which loads a separate table in place of the model's own and allows the quant's table file to be missing.engram/README.mdfor all 22 quants. A wrong match cannot load wrong weights: llama.cpp refuses a set that is not exactly one table short.engram_precisionon/api/inference/loadandunsloth run --engram. Naming the quant's own table is the same as naming none. An unpublished precision, a non-GGUF model, or a llama.cpp build without--pleis refused with a clear message, before the loaded model is touched./status, and changing it reloads the model.Not changed
Testing
--ple, and chatted normally. The two tables give different token probabilities from the first token.test_engram_tables.py,test_engram_tables_fuzz.py(property tests), and frontendengram-precision-setting,download-engram-tableanddownload-engram-matching. Existing backend and frontend suites pass, except three tests that fail the same way on main.UI check at 0597255
Run settings for
unsloth/Qwen3.8-Flash-Next-GGUFUD-IQ1_S, two separate Studio installs (merge base 480fd26 vs this PR), nothing loaded or downloaded.