Fixed #37
This commit is contained in:
@@ -154,26 +154,17 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Convert to the directory pattern used by HuggingFace
|
# Convert to the directory pattern used by HuggingFace
|
||||||
# This is a heuristic - look for directories starting with the model name
|
|
||||||
|
|
||||||
if [ -d "$HUB_PATH" ]; then
|
if [ -d "$HUB_PATH" ]; then
|
||||||
# Search for model directories matching the pattern
|
|
||||||
# Different quantizations of the same model will have different suffixes
|
|
||||||
# Try different patterns to find the downloaded model
|
|
||||||
if [ -n "$ORG" ]; then
|
if [ -n "$ORG" ]; then
|
||||||
# Look for directories starting with "models--$ORG--$MODEL"
|
MODEL_DIR="$HUB_PATH/models--${ORG}--${MODEL}"
|
||||||
mapfile -t potential_dirs < <(find "$HUB_PATH" -maxdepth 1 -type d -name "models--${ORG}--${MODEL}*" 2>/dev/null)
|
|
||||||
else
|
else
|
||||||
# Look for directories starting with the model name
|
# For models without org, check both patterns
|
||||||
mapfile -t potential_dirs < <(find "$HUB_PATH" -maxdepth 1 -type d -name "${MODEL}*" 2>/dev/null)
|
if [ -d "$HUB_PATH/models--${MODEL}" ]; then
|
||||||
fi
|
MODEL_DIR="$HUB_PATH/models--${MODEL}"
|
||||||
|
else
|
||||||
# If we found potential directories, use the most recently modified one
|
MODEL_DIR="$HUB_PATH/${MODEL}"
|
||||||
if [ ${#potential_dirs[@]} -gt 0 ]; then
|
fi
|
||||||
# Sort by modification time, most recent first
|
|
||||||
IFS=$'\n' SORTED_DIRS=($(sort -r -k9,10 <<<"${potential_dirs[*]}"))
|
|
||||||
unset IFS
|
|
||||||
MODEL_DIR="${SORTED_DIRS[0]}"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user