Repository navigation
fix: look for MLX models in $HF_HOME/hub - #61
Open
spicysharkco wants to merge 1 commit into
Open
spicysharkco wants to merge 1 commit into
spicysharkco wants to merge 1 commit into
Conversation
HF_HOME is the root of the Hugging Face cache and the hub cache lives in $HF_HOME/hub, but model discovery and the Sources tree used HF_HOME itself as the hub directory. With HF_HOME set, no MLX models were found. Both now resolve the directory through one helper, matching the default used when HF_HOME is unset.
AlexsJones
approved these changes
Oct 21, 2026
AlexsJones
left a comment
Owner
There was a problem hiding this comment.
Thanks @spicysharkco, treating HF_HOME as the hub itself rather than the cache root is an easy mistake and this matches how Hugging Face documents it.
Checked at 56a4580: hf_hub_dir returns $HF_HOME/hub or the unchanged ~/.cache/huggingface/hub default, and both callers (discover_models and the tree label in app.rs) use it, so the sidebar path and the scan agree. The test builds a snapshot under a temp HF_HOME and proves scan_mlx_models finds it there. The cfg!(windows) branch that picked the same path either way is gone, which is a small cleanup on its own.
No checks have run on this PR (fork workflow approval), so CI hasn't been exercised on this head yet. Looks good to me otherwise.
This branch has not been deployed
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.
Problem
discover_modelsusesHF_HOMEas the hub directory. Hugging Face treatsHF_HOMEas the cache root and keeps the hub cache in$HF_HOME/hub, the same layout as the unset fallback. WithHF_HOME=/data/hf, the models in/data/hf/hubare never scanned, so its MLX models are not listed.Change
hf_hub_dirreturns$HF_HOME/hub, or~/.cache/huggingface/hubwhen unset.discover_modelsand the Sources tree inbuild_treeboth use it.Tests
cargo test --lib hf_homebuilds a cache under a tempHF_HOMEroot and expects the MLX model to be found, plus the unset default. It passes; with the helper returningHF_HOMEunchanged (the old behaviour) it fails withleft: 0, right: 1.