Skip to content

Studio: add configurable model download location - #7274

Merged
danielhanchen merged 31 commits into
unslothai:mainfrom
oobabooga:feat/studio-hf-cache-location
Jul 23, 2026
Merged

danielhanchen merged 31 commits into
unslothai:mainfrom
oobabooga:feat/studio-hf-cache-location

Conversation

@oobabooga

Copy link
Copy Markdown
Member

Studio downloads models into Hugging Face's default cache on the system disk. Users can redirect it with environment variables before startup, but cannot choose a larger disk or external drive from Studio.

What changed

Settings > System > Storage now shows the active model download location and lets users change it. The desktop app uses a native folder picker and can open the location. The web app uses Studio's folder browser and can copy the path.

Cache-sensitive workflows are standardized as subprocesses. Each child captures the selected cache before importing Hugging Face libraries, while remaining in-process calls receive the cache path explicitly. This makes changes apply to new model, dataset, training, inference, export, and helper downloads without restarting Studio.

Running downloads stay in their original cache. Models in default and previously selected caches remain available. Explicit Hugging Face cache environment variables remain authoritative and read-only. Existing files and credentials are not moved.

unsloth-cache-ooba

Verification

  • 123 focused backend tests
  • Live cache switch with a real Hugging Face model-file download
  • Frontend build, typecheck, translation parity, ESLint, and Playwright
  • Tauri cargo check, Python lint, and compile checks

Follow-up to #5182, adding the UI-configurable download location discussed there.

@oobabooga
oobabooga requested a review from danielhanchen as a code owner July 21, 2026 02:48

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a centralized Hugging Face cache routing system to manage and persist cache directories across Unsloth Studio. It updates various backend services, training/inference workers, and download lifecycles to dynamically respect these cache paths, and adds frontend settings to allow users to configure their download locations. Feedback on the changes highlights a thread-safety concern when mutating os.environ in concurrent environments, a logical bug in model deduplication when comparing custom folders and inactive caches, and a Windows-specific issue where std::fs::canonicalize returns UNC prefixes that can cause compatibility issues with Python.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread studio/src-tauri/src/native_intents.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5101ef8f2d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/core/rag/embeddings.py Resolved
@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 241931792e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/utils/hf_xet_fallback.py Resolved
Comment thread studio/backend/routes/models.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de6823af19

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/utils/hf_xet_fallback.py Resolved
@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 600f80e0e2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4dfbb924dd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 832bd9a4b6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ddbeb253cf

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 1a95041299

ℹ️ 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 Hub delete route ignored the inventory row's cache, so a delete
always fell back to the active cache and could remove the wrong copy
when a row showed a previously selected cache. Accept cache_path on the
model and dataset delete routes and send the row's cache path from the
frontend so the delete targets the cache the row represents.

Also scope the download-manifest and cancel-marker purge to the owning
cache (hub_cache on purge_state / purge_all_state_for_repo) so deleting
one cache's copy no longer clears another cache's resumable state.
@danielhanchen
danielhanchen force-pushed the feat/studio-hf-cache-location branch from 1a95041 to 2841d03 Compare July 22, 2026 13:10
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2841d03b77

ℹ️ 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".

Comment on lines +369 to +371
target_root = resolve_delete_target_root("dataset", repo_id, cache_path, owners.keys())
if target_root is None:
raise HTTPException(status_code = 400, detail = "Invalid cache_path")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve deletion of processed-only dataset caches

When a dataset exists only in the processed Arrow cache, _scan_processed_dataset_caches exposes its cache_path as <HF_DATASETS_CACHE>/<owner>___<repo>, and the updated frontend now sends that value on delete. That path is not a datasets--... directory beneath a Hub cache, so resolve_delete_target_root returns None here and the endpoint returns 400 Invalid cache_path before _delete_processed_dataset_cache can remove it. As a result, processed-only dataset rows can no longer be deleted from the UI.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6cf2f53: a processed-only dataset row sends its Arrow cache path (___ under HF_DATASETS_CACHE), so the delete now accepts that path and falls through to the processed-cache delete instead of returning 400, and the Hub-cache purges run only when there is a Hub target.

A processed-only dataset row sends its Arrow cache path (<owner>___<repo>
under HF_DATASETS_CACHE), which is not a Hub datasets-- directory, so the
new cache_path scoping rejected it with 400 before the processed-cache
delete could run. Accept a valid processed cache path and fall through to
that delete, and only run the Hub-cache purges when there is a Hub target.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6cf2f53f6c

ℹ️ 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".

continue
owners.setdefault(owner, []).append((hf_cache, repo_info))

target_root = resolve_delete_target_root("model", repo_id, cache_path, owners.keys())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the selected cache path for local-card deletion

When a model is shown from a previously selected HF cache, LocalOnDeviceCard still calls deleteCachedModel(repoId, ...) without its path, so this new fallback resolves the delete to the active cache. If the same repo exists in the active cache, deleting the old-cache card removes the active copy instead; if it does not, the visible old-cache model cannot be deleted and returns 404. Pass the displayed cache path through this flow (as the other cache-row delete callers do) so cache_path selects the intended root.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 68a582f: the On Device card only offers delete for hf_cache rows, so it now passes the shown snapshot path as cache_path and resolve_delete_target_root resolves the owning cache from it instead of falling back to the active cache.

LocalOnDeviceCard deleted by repo id only, so a model shown from a
previously selected HF cache resolved to the active cache: it removed the
active copy when the repo existed there, or 404'd when it did not. Delete
is only offered for hf_cache rows, so pass the shown snapshot path as
cache_path and the owning cache is resolved from it.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 68a582fe4b

ℹ️ 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".

Comment on lines +584 to +587
manifest_path(repo_type, repo_id, variant, hub_cache = hub_cache),
marker_path(repo_type, repo_id, variant, hub_cache = hub_cache),
manifest_path(repo_type, repo_id, variant),
marker_path(repo_type, repo_id, variant),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep legacy state scoped to its cache during deletion

When deleting a copy from a non-active cache after upgrading, this branch unconditionally includes the unscoped legacy manifest and cancel-marker paths in the purge. That conflicts with _legacy_state_applies, which treats an unowned legacy state file as belonging only to the currently selected cache: deleting an old cache can therefore erase the active cache's resume/cancel state and make an interrupted active download appear complete or non-resumable. Filter these legacy paths through _legacy_state_applies before unlinking them, as delete_manifest and clear_cancel_marker already do.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5f15747: purge_state now filters the unscoped legacy manifest and cancel marker through _legacy_state_applies before unlinking, so deleting an inactive cache no longer erases the active cache's resume or cancel state. Added regression tests for both the preserve and the owned-legacy cases.

purge_state unconditionally purged the unscoped legacy manifest and
cancel marker when scoped to a cache, but _legacy_state_applies treats an
unowned legacy file as belonging to the active cache. Deleting an
inactive cache could therefore erase the active cache's resume/cancel
state. Filter the legacy paths through _legacy_state_applies before
unlinking, matching delete_manifest and clear_cancel_marker.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f15747d03

ℹ️ 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".

Comment on lines +288 to +293
upsert_app_settings(
{
CACHE_HOME_SETTING_KEY: str(next_home) if next_home is not None else None,
CACHE_HISTORY_SETTING_KEY: deduped,
}
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Route offline cache checks through the selected cache

When a user changes the cache location after backend startup and then loads a RAG embedding model while offline, this only persists the new setting while the process-level HF_HUB_CACHE remains pointed at the startup cache. hf_cache_snapshot_dir() still reads that environment variable, and the offline file-security gate therefore sees the old/empty cache and permits the load; SentenceTransformer subsequently loads from the new location via its explicit cache_folder. A selected-cache model containing pickle weights can consequently bypass the offline security check. Make the snapshot/security lookup use get_hf_cache_paths().hub_cache rather than the stale process environment.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d0e8f58: hf_cache_snapshot_dir now searches the selected hub cache (get_hf_cache_paths().hub_cache) first, with the env precedence following for previous-cache copies, so the offline security gate inspects the same cache the loader reads via cache_folder rather than the stale process env.

Comment on lines 87 to +94
size_mismatched: tuple[str, ...]


def _canonical_hub_cache(hub_cache: Optional[str | Path] = None) -> Optional[str]:
if hub_cache is None:
try:
from utils.hf_cache_settings import get_hf_cache_paths
hub_cache = get_hf_cache_paths().hub_cache

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bind each download worker's manifests to its captured cache

If the cache location is changed while a model or dataset worker is still running, the worker continues downloading into the HF_HUB_CACHE inherited at spawn, but manifest and marker calls without hub_cache resolve this function against the newly persisted setting. The worker can therefore write its expected-files state under the new cache while the bytes remain in the old one, leaving the old copy without the manifest needed for partial/resume verification and making the new cache show phantom partial state. Capture the worker's hub-cache root once and pass it to all manifest/state operations.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The worker is spawned with env from child_env(), which pins HF_HUB_CACHE to the cache captured at spawn. In the worker that value is in _EXPLICIT_CACHE_ENV, so _environment_paths() returns it and get_hf_cache_paths() short-circuits before ever consulting the persisted DB setting. So _canonical_hub_cache(None) resolves to the same spawn cache the worker downloads into, not the newly persisted one; there is no split between bytes and manifest state.

hf_cache_snapshot_dir searched only the process env, but after a
no-restart cache switch that is stale while the loader reads the selected
cache via cache_folder=active_hf_hub_cache(). The offline security gate
therefore scanned the old cache and permitted a pickle-weight model that
then loaded from the new one. Search the selected hub cache first (env
precedence follows for previous-cache copies) so the gate inspects where
the model actually loads.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

processed_deleted, processed_failures = _delete_processed_dataset_cache(repo_id)

P1 Badge Scope processed dataset deletion to the selected cache

When a dataset has processed Arrow caches in more than one HF_DATASETS_CACHE root, deleting the row for one selected Hub cache still calls _delete_processed_dataset_cache(repo_id) without the requested cache_path. That helper iterates every processed-cache root, so this operation deletes copies from previously selected/unrelated cache locations despite the new per-cache targeting; pass the resolved target (or the processed cache path) through and restrict its scan to that root.

ℹ️ 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".

from pathlib import Path

from utils.native_path_leases import child_env_without_native_path_secret
from utils.hf_cache_settings import get_hf_cache_paths

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Read offline version metadata from the selected cache

After switching the cache without restarting, the main process intentionally retains its original HF_HUB_CACHE, but _adapter_base_from_hf_cache and _config_json_from_hf_cache still read that environment variable directly. Consequently, an offline load (or a transient Hub failure) of a model that exists only in the newly selected cache cannot inspect its config/adapter metadata for transformer-tier selection; Studio can skip the required sidecar upgrade and the subsequent worker load fails. Route these helpers through get_hf_cache_paths().hub_cache, like the newly updated subprocess paths.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7b80d7f: _adapter_base_from_hf_cache and _config_json_from_hf_cache now resolve the hub cache via get_hf_cache_paths().hub_cache instead of the process HF_HUB_CACHE env, so offline config/adapter metadata for a model in the newly selected cache is found after a no-restart switch.

… cache

Two selected-cache scoping gaps:
- _delete_cached_dataset_blocking called _delete_processed_dataset_cache
  across every HF_DATASETS_CACHE root, so deleting one row removed
  processed Arrow copies under other cache homes. Restrict the processed
  delete to the selected cache's datasets root (the processed cache path's
  own root, or the datasets root sharing the Hub target's cache home).
- _adapter_base_from_hf_cache and _config_json_from_hf_cache read the
  process HF_HUB_CACHE env, stale after a no-restart switch, so offline
  metadata for a model in the newly selected cache was missed. Route both
  through get_hf_cache_paths().hub_cache.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b80d7f640

ℹ️ 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".

Comment on lines +32 to +35
def hf_cache_root(*, create: bool = False, root: Optional[Path] = None) -> Optional[Path]:
from utils.hf_cache_settings import get_hf_cache_paths

root = root or get_hf_cache_paths().hub_cache

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep worker cache-state operations on the captured cache

When a user changes the cache location while an already-started download worker is running, the worker's HF_HUB_CACHE still correctly points to the originally captured cache, but this default now rereads the database and selects the newly configured cache. Consequently the worker's prepare_cache_for_transport, manifest, cancel-marker, and disk-space calls operate on the new cache while snapshot_download writes to the old one; this leaves transport/manifest state in the wrong location and can break later resume/partial detection. Derive the default root from the worker's captured HF_HUB_CACHE (or pass that root explicitly at each worker call).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The worker is spawned with env from child_env(), which pins HF_HUB_CACHE to the cache captured at spawn (download_lifecycle passes it to Popen). In the worker that value is present in os.environ at import, so _EXPLICIT_CACHE_ENV captures it and _environment_paths() returns it; get_hf_cache_paths() then short-circuits on the environment and never rereads the DB. hf_cache_root()'s default therefore resolves to the same captured cache snapshot_download writes to, even if the parent switches the location mid-download. Verified in a subprocess: with HF_HUB_CACHE pinned to the spawn cache and the DB switched to a different path, get_hf_cache_paths().hub_cache returns the spawn cache, not the DB one. So there is no split between the worker's transport/manifest state and its bytes.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 7b80d7f640

ℹ️ 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".

Resolve two frontend conflicts:
- folder-browser.tsx: keep the showModelHints guard, adopt main's rem-based
  badge sizing.
- resources-tab.tsx: keep the cache-aware models-folder widget (Input plus
  open/copy button) the feature depends on; main only restyled the old span.
Resolve the same two frontend conflicts against main's typography-scale
refactor (unslothai#7359):
- folder-browser.tsx: keep the showModelHints guard, adopt main's text-ui-9
  badge sizing.
- resources-tab.tsx: keep the cache-aware models-folder widget the feature
  needs; main only restyled the old span.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants