fix: match filename only in grep pattern for HuggingFace cache structure

HuggingFace cache flattens repository directory structure into snapshots.
When YAML specifies "vae/model.safetensors", the cache stores it as just
"model.safetensors" without preserving the vae/ subdirectory.

Changed grep pattern from "/$source_pattern$" to "/$filename_only$" to
match the actual flattened cache structure instead of the logical repo path.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-25 20:08:28 +01:00
parent 7a1e64862a
commit 71f7391fd1

View File

@@ -623,9 +623,9 @@ link_model() {
local filename_only
filename_only=$(basename "$source_pattern")
# Find files matching the filename, then filter by full source pattern
# Find files matching the filename (HuggingFace cache flattens directory structure)
local source_file
source_file=$(find_model_files "$repo_id" "$filename_only" 2>/dev/null | grep "/$source_pattern$" | head -n1)
source_file=$(find_model_files "$repo_id" "$filename_only" 2>/dev/null | grep "/$filename_only$" | head -n1)
if [[ -z "$source_file" ]] || [[ ! -f "$source_file" ]]; then
print_warning "Source file not found: ${source_pattern}"