Commit 73c81b2f authored by Your Name's avatar Your Name

Fix: Correct HuggingFace cache directory detection

- Updated get_all_cache_dirs() to properly find HuggingFace hub directory
- Now checks for ~/.cache/huggingface/hub/ instead of just ~/.cache/huggingface/
- This fixes --list-cached-models not showing HuggingFace cached models
parent 2cedd442
...@@ -30,22 +30,26 @@ def get_all_cache_dirs() -> dict: ...@@ -30,22 +30,26 @@ def get_all_cache_dirs() -> dict:
"""Get all model cache directories.""" """Get all model cache directories."""
caches = {} caches = {}
cache_home = os.environ.get('XDG_CACHE_HOME', os.path.expanduser('~/.cache')) cache_home = os.environ.get('XDG_CACHE_HOME', os.path.expanduser('~/.cache'))
# Coderai GGUF cache # Coderai GGUF cache
coderai_cache = os.path.join(cache_home, 'coderai', 'models') coderai_cache = os.path.join(cache_home, 'coderai', 'models')
if os.path.exists(coderai_cache): if os.path.exists(coderai_cache):
caches['coderai'] = coderai_cache caches['coderai'] = coderai_cache
# HuggingFace cache (for .safetensors, PyTorch models, etc.) # HuggingFace cache (for .safetensors, PyTorch models, etc.)
# Check both the main directory and the hub subdirectory
hf_cache = os.path.join(cache_home, 'huggingface') hf_cache = os.path.join(cache_home, 'huggingface')
if os.path.exists(hf_cache): hf_hub_cache = os.path.join(hf_cache, 'hub')
if os.path.exists(hf_hub_cache):
caches['huggingface'] = hf_hub_cache # Use hub directory if it exists
elif os.path.exists(hf_cache):
caches['huggingface'] = hf_cache caches['huggingface'] = hf_cache
# Local diffusers cache (often stored locally by apps) # Local diffusers cache (often stored locally by apps)
local_diffusers = os.path.expanduser('~/.cache/diffusers') local_diffusers = os.path.expanduser('~/.cache/diffusers')
if os.path.exists(local_diffusers): if os.path.exists(local_diffusers):
caches['diffusers'] = local_diffusers caches['diffusers'] = local_diffusers
return caches return caches
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment