diff --git a/artifact_huggingface_download.sh b/artifact_huggingface_download.sh index 687916f..9941ffa 100755 --- a/artifact_huggingface_download.sh +++ b/artifact_huggingface_download.sh @@ -613,24 +613,15 @@ link_model() { return 0 fi - # Find all model files in cache (no filter needed, we have explicit paths) - local model_files - model_files=$(find_model_files "$repo_id" "") - - if [[ -z "$model_files" ]]; then - print_warning "No model files found in cache for ${repo_id}" - return 1 - fi - - # Process each file mapping + # Process each file mapping - find each file individually by its pattern while IFS='|' read -r source_pattern dest_path; do if [[ -z "$source_pattern" ]] || [[ -z "$dest_path" ]]; then continue fi - # Find the file matching the source pattern in model_files + # Find the specific file using its source pattern as filter local source_file - source_file=$(echo "$model_files" | grep -F "/$source_pattern" | head -n1) + source_file=$(find_model_files "$repo_id" "$source_pattern" 2>/dev/null | head -n1) if [[ -z "$source_file" ]] || [[ ! -f "$source_file" ]]; then print_warning "Source file not found: ${source_pattern}" @@ -1061,15 +1052,7 @@ verify_model_links() { # Check if explicit file mappings exist if [[ -n "$file_mappings" ]]; then - # Verify files exist in cache (no filter needed) - local model_files - model_files=$(find_model_files "$repo_id" "" 2>/dev/null) - - if [[ -z "$model_files" ]]; then - echo "NOT_DOWNLOADED|0|0|0" - return 1 - fi - + # Process each file mapping to verify links while IFS='|' read -r source_pattern dest_path; do if [[ -z "$source_pattern" ]] || [[ -z "$dest_path" ]]; then continue