Skip to content

Commit

Permalink
feat: download with include and exclude patterns (#186)
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming authored Feb 18, 2025
1 parent 0ad5fb7 commit a2c821d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion controllers/resources/bentorequest_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2089,10 +2089,19 @@ if [[ ${url} == hf://* ]]; then
model_id=$(echo "$hf_url" | awk -F '@' '{print $1}')
revision=$(echo "$hf_url" | awk -F '@' '{print $2}')
endpoint=$(echo "$hf_url" | awk -F '@' '{print $3}')
include=$(echo "$hf_url" | awk -F '@' '{print $4}')
exclude=$(echo "$hf_url" | awk -F '@' '{print $5}')
export HF_ENDPOINT=${endpoint}
echo "Downloading model ${model_id} (endpoint=${endpoint}, revision=${revision}) from Huggingface..."
huggingface-cli download ${model_id} --revision ${revision} --cache-dir {{.ModelDirPath}}
cmd="huggingface-cli download ${model_id} --revision ${revision} --cache-dir {{.ModelDirPath}}"
if [ -n "${include}" ]; then
cmd="$cmd --include ${include//&/ }"
fi
if [ -n "${exclude}" ]; then
cmd="$cmd --exclude ${exclude//&/ }"
fi
eval $cmd
else
echo "Downloading model {{.ModelRepositoryName}}:{{.ModelVersion}} to /tmp/downloaded.tar..."
if [[ ${url} == s3://* ]]; then
Expand Down

0 comments on commit a2c821d

Please sign in to comment.