fix: correct HuggingFace cache path detection

- Check for models in cache_dir/models--xxx--yyy/ first
- Fallback to cache_dir/hub/models--xxx--yyy/ for compatibility
- Fixes issue where script couldn't find downloaded models

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-22 16:02:38 +01:00
parent 272957dae4
commit c1c4052054

View File

@@ -307,11 +307,16 @@ cache_dir = '${CACHE_DIR}'
repo_id = '${repo_id}'
filename_filter = '${filename_filter}'
# HuggingFace cache structure: cache_dir/hub/models--org--name/snapshots/hash/
cache_path = Path(cache_dir) / 'hub'
# HuggingFace cache structure: cache_dir/models--org--name/snapshots/hash/
# Try both with and without 'hub/' subdirectory for compatibility
cache_path = Path(cache_dir)
repo_path = repo_id.replace('/', '--')
model_dir = cache_path / f'models--{repo_path}'
# Fallback to hub/ subdirectory if direct path doesn't exist
if not model_dir.exists():
model_dir = cache_path / 'hub' / f'models--{repo_path}'
if not model_dir.exists():
sys.exit(1)