Unverified Commit 481bf395 authored by Keiven C's avatar Keiven C Committed by GitHub
Browse files

refactor: standardize HF_CACHE to HF_HOME across codebase (use Hugging Face convention) (#3310)


Signed-off-by: default avatarKeiven Chang <keivenchang@users.noreply.github.com>
parent 6ffd20a8
...@@ -111,7 +111,7 @@ export MOUNTS="${PWD}/../:/mnt" ...@@ -111,7 +111,7 @@ export MOUNTS="${PWD}/../:/mnt"
# NOTE: In general, Deepseek R1 is very large, so it is recommended to # NOTE: In general, Deepseek R1 is very large, so it is recommended to
# pre-download the model weights and save them in some shared location, # pre-download the model weights and save them in some shared location,
# NFS storage, HF_CACHE, etc. and modify the `--model-path` below # NFS storage, HF_HOME, etc. and modify the `--model-path` below
# to reuse the pre-downloaded weights instead. # to reuse the pre-downloaded weights instead.
# #
# On Blackwell systems (ex: GB200), it is recommended to use the FP4 weights: # On Blackwell systems (ex: GB200), it is recommended to use the FP4 weights:
......
...@@ -74,7 +74,7 @@ export IMAGE="<dynamo_trtllm_image>" ...@@ -74,7 +74,7 @@ export IMAGE="<dynamo_trtllm_image>"
# NOTE: In general, Deepseek R1 is very large, so it is recommended to # NOTE: In general, Deepseek R1 is very large, so it is recommended to
# pre-download the model weights and save them in some shared location, # pre-download the model weights and save them in some shared location,
# NFS storage, HF_CACHE, etc. and modify the `--model-path` below # NFS storage, HF_HOME, etc. and modify the `--model-path` below
# to reuse the pre-downloaded weights instead. # to reuse the pre-downloaded weights instead.
# #
# On Blackwell systems (ex: GB200), it is recommended to use the FP4 weights: # On Blackwell systems (ex: GB200), it is recommended to use the FP4 weights:
......
...@@ -31,8 +31,8 @@ DEFAULT_FRAMEWORK=VLLM ...@@ -31,8 +31,8 @@ DEFAULT_FRAMEWORK=VLLM
SOURCE_DIR=$(dirname "$(readlink -f "$0")") SOURCE_DIR=$(dirname "$(readlink -f "$0")")
IMAGE= IMAGE=
HF_CACHE= HF_HOME=${HF_HOME:-}
DEFAULT_HF_CACHE=${SOURCE_DIR}/.cache/huggingface DEFAULT_HF_HOME=${SOURCE_DIR}/.cache/huggingface
GPUS="all" GPUS="all"
PRIVILEGED= PRIVILEGED=
VOLUME_MOUNTS= VOLUME_MOUNTS=
...@@ -85,9 +85,9 @@ get_options() { ...@@ -85,9 +85,9 @@ get_options() {
missing_requirement "$1" missing_requirement "$1"
fi fi
;; ;;
--hf-cache) --hf-cache|--hf-home)
if [ "$2" ]; then if [ "$2" ]; then
HF_CACHE=$2 HF_HOME=$2
shift shift
else else
missing_requirement "$1" missing_requirement "$1"
...@@ -250,8 +250,8 @@ get_options() { ...@@ -250,8 +250,8 @@ get_options() {
VOLUME_MOUNTS+=" -v /tmp:/tmp " VOLUME_MOUNTS+=" -v /tmp:/tmp "
VOLUME_MOUNTS+=" -v /mnt/:/mnt " VOLUME_MOUNTS+=" -v /mnt/:/mnt "
if [ -z "$HF_CACHE" ]; then if [ -z "$HF_HOME" ]; then
HF_CACHE=$DEFAULT_HF_CACHE HF_HOME=$DEFAULT_HF_HOME
fi fi
if [ -z "${PRIVILEGED}" ]; then if [ -z "${PRIVILEGED}" ]; then
...@@ -263,19 +263,19 @@ get_options() { ...@@ -263,19 +263,19 @@ get_options() {
INTERACTIVE=" -it " INTERACTIVE=" -it "
fi fi
if [[ ${HF_CACHE^^} == "NONE" ]]; then if [[ ${HF_HOME^^} == "NONE" ]]; then
HF_CACHE= HF_HOME=
fi fi
if [ -n "$HF_CACHE" ]; then if [ -n "$HF_HOME" ]; then
mkdir -p "$HF_CACHE" mkdir -p "$HF_HOME"
# Use /home/ubuntu for local-dev target, /root for dev target. # Use /home/ubuntu for local-dev target, /root for dev target.
if [ "$TARGET" = "local-dev" ] || [[ "$IMAGE" == *"local-dev"* ]]; then if [ "$TARGET" = "local-dev" ] || [[ "$IMAGE" == *"local-dev"* ]]; then
HF_CACHE_TARGET="/home/ubuntu/.cache/huggingface" HF_HOME_TARGET="/home/ubuntu/.cache/huggingface"
else else
HF_CACHE_TARGET="/root/.cache/huggingface" HF_HOME_TARGET="/root/.cache/huggingface"
fi fi
VOLUME_MOUNTS+=" -v $HF_CACHE:$HF_CACHE_TARGET" VOLUME_MOUNTS+=" -v $HF_HOME:$HF_HOME_TARGET"
fi fi
if [ -z "${PRIVILEGED}" ]; then if [ -z "${PRIVILEGED}" ]; then
...@@ -325,7 +325,7 @@ show_help() { ...@@ -325,7 +325,7 @@ show_help() {
echo " [--name name for launched container, default NONE]" echo " [--name name for launched container, default NONE]"
echo " [--privileged whether to launch in privileged mode, default FALSE unless mounting workspace]" echo " [--privileged whether to launch in privileged mode, default FALSE unless mounting workspace]"
echo " [--dry-run print docker commands without running]" echo " [--dry-run print docker commands without running]"
echo " [--hf-cache directory to volume mount as the hf cache, default is NONE unless mounting workspace]" echo " [--hf-home|--hf-cache directory to volume mount as the hf home, default is NONE unless mounting workspace]"
echo " [--gpus gpus to enable, default is 'all', 'none' disables gpu support]" echo " [--gpus gpus to enable, default is 'all', 'none' disables gpu support]"
echo " [--use-nixl-gds add volume mounts and capabilities needed for NVIDIA GPUDirect Storage]" echo " [--use-nixl-gds add volume mounts and capabilities needed for NVIDIA GPUDirect Storage]"
echo " [--network network mode for container, default is 'host']" echo " [--network network mode for container, default is 'host']"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment