From 7bc3c8ba7d6a29893025e96bad3d9132000bea70 Mon Sep 17 00:00:00 2001 From: Keiven Chang Date: Tue, 30 Sep 2025 15:14:37 +0000 Subject: [PATCH] refactor: standardize HF_CACHE to HF_HOME across codebase - Update container/run.sh to use HF_HOME variable and --hf-home option - Maintain backward compatibility with --hf-cache option - Update documentation references in multinode and performance sweep examples - Align with Hugging Face standard environment variable naming Ref: https://github.com/search?q=repo%3Aai-dynamo%2Fdynamo%20HF_HOME&type=code Signed-off-by: Keiven Chang --- .../trtllm/multinode/multinode-examples.md | 2 +- .../trtllm/performance_sweeps/README.md | 2 +- container/run.sh | 28 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/components/backends/trtllm/multinode/multinode-examples.md b/components/backends/trtllm/multinode/multinode-examples.md index 8e511faac1..be76bad1ba 100644 --- a/components/backends/trtllm/multinode/multinode-examples.md +++ b/components/backends/trtllm/multinode/multinode-examples.md @@ -111,7 +111,7 @@ export MOUNTS="${PWD}/../:/mnt" # 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, -# 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. # # On Blackwell systems (ex: GB200), it is recommended to use the FP4 weights: diff --git a/components/backends/trtllm/performance_sweeps/README.md b/components/backends/trtllm/performance_sweeps/README.md index d305fac954..cda70cc7ae 100644 --- a/components/backends/trtllm/performance_sweeps/README.md +++ b/components/backends/trtllm/performance_sweeps/README.md @@ -74,7 +74,7 @@ export IMAGE="" # 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, -# 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. # # On Blackwell systems (ex: GB200), it is recommended to use the FP4 weights: diff --git a/container/run.sh b/container/run.sh index a298ff73b9..e9512e5063 100755 --- a/container/run.sh +++ b/container/run.sh @@ -31,8 +31,8 @@ DEFAULT_FRAMEWORK=VLLM SOURCE_DIR=$(dirname "$(readlink -f "$0")") IMAGE= -HF_CACHE= -DEFAULT_HF_CACHE=${SOURCE_DIR}/.cache/huggingface +HF_HOME=${HF_HOME:-} +DEFAULT_HF_HOME=${SOURCE_DIR}/.cache/huggingface GPUS="all" PRIVILEGED= VOLUME_MOUNTS= @@ -85,9 +85,9 @@ get_options() { missing_requirement "$1" fi ;; - --hf-cache) + --hf-cache|--hf-home) if [ "$2" ]; then - HF_CACHE=$2 + HF_HOME=$2 shift else missing_requirement "$1" @@ -250,8 +250,8 @@ get_options() { VOLUME_MOUNTS+=" -v /tmp:/tmp " VOLUME_MOUNTS+=" -v /mnt/:/mnt " - if [ -z "$HF_CACHE" ]; then - HF_CACHE=$DEFAULT_HF_CACHE + if [ -z "$HF_HOME" ]; then + HF_HOME=$DEFAULT_HF_HOME fi if [ -z "${PRIVILEGED}" ]; then @@ -263,19 +263,19 @@ get_options() { INTERACTIVE=" -it " fi - if [[ ${HF_CACHE^^} == "NONE" ]]; then - HF_CACHE= + if [[ ${HF_HOME^^} == "NONE" ]]; then + HF_HOME= fi - if [ -n "$HF_CACHE" ]; then - mkdir -p "$HF_CACHE" + if [ -n "$HF_HOME" ]; then + mkdir -p "$HF_HOME" # Use /home/ubuntu for local-dev target, /root for dev target. if [ "$TARGET" = "local-dev" ] || [[ "$IMAGE" == *"local-dev"* ]]; then - HF_CACHE_TARGET="/home/ubuntu/.cache/huggingface" + HF_HOME_TARGET="/home/ubuntu/.cache/huggingface" else - HF_CACHE_TARGET="/root/.cache/huggingface" + HF_HOME_TARGET="/root/.cache/huggingface" fi - VOLUME_MOUNTS+=" -v $HF_CACHE:$HF_CACHE_TARGET" + VOLUME_MOUNTS+=" -v $HF_HOME:$HF_HOME_TARGET" fi if [ -z "${PRIVILEGED}" ]; then @@ -325,7 +325,7 @@ show_help() { echo " [--name name for launched container, default NONE]" echo " [--privileged whether to launch in privileged mode, default FALSE unless mounting workspace]" 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 " [--use-nixl-gds add volume mounts and capabilities needed for NVIDIA GPUDirect Storage]" echo " [--network network mode for container, default is 'host']"