Repository navigation
Studio training cond cache: evict only entries the cache wrote - #18564
Merged
Merged
Conversation
Eviction picked any *.safetensors whose name started with lat_v, txt_v, h3clip_v or h3img_v, so in an explicitly chosen directory a user file such as txt_vintage.safetensors was unlinked once the cap was crossed. Entries now carry an owner marker in their safetensors metadata and eviction requires a cache key name plus that marker (or the exact metadata older entries were written with); anything else is never counted or removed.
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. |
Member
Author
|
@codex review |
1 similar comment
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#18519 added a size cap to the persistent training conditioning cache, with least recently used eviction. Eviction decided ownership from the file name alone: any
*.safetensorsstarting withlat_v,txt_v,h3clip_vorh3img_vwas counted and could be unlinked. The cache directory can be set by the user (cond_cache_dir), so a user's own file in that directory such astxt_vintage.safetensorsortxt_v1_my_embeddings.safetensorswas deleted once a write crossed the cap.Change
PersistentConditioningCache.putnow carries an owner marker (unsloth_cond_cache: 1) in its safetensors metadata._entries()only considers a file that passes all of these checks:lat|txt|h3clip|h3img, then_vand a version digit);version,family,none_slots,countovert<i>tensors), so existing caches stay bounded.Reads, keys and stored tensors are unchanged.
Tests
test_eviction_never_touches_a_user_file_named_like_a_cache_keywrites valid user safetensors files named with every cache prefix, plus one with a partial lookalike header. It then fills the cache past a 1 byte cap. It fails on main (the user files are unlinked) and passes here.test_entries_written_before_the_owner_marker_are_still_evictedchecks that an entry with the pre-marker metadata is still evicted oldest first. It passes on both.tests/test_diffusion_train_cond_cache_default.py,test_diffusion_cond_cache.py,test_diffusion_cond_cache_rekey.py,test_diffusion_h3_trainer.py,test_diffusion_train_extras.py,test_diffusion_bucketing.py,test_diffusion_cond_blocks.py,test_diffusion_dit_trainer_ltx25.pyandtest_diffusion_prompt_cache.py:The same 15 test IDs fail on both. They are environment failures (missing
jwtand similar optional modules on the CPU test host).Not proven