From 01392192ddaf4370355746b308083fc9d60ffcee Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Mon, 19 May 2025 19:50:52 +0000 Subject: [PATCH 1/2] [neuron] fix authorization issue Signed-off-by: Liangfu Chen --- .buildkite/scripts/hardware_ci/run-neuron-test.sh | 4 +++- tests/neuron/1_core/test_download.py | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tests/neuron/1_core/test_download.py diff --git a/.buildkite/scripts/hardware_ci/run-neuron-test.sh b/.buildkite/scripts/hardware_ci/run-neuron-test.sh index ec6a080eb499..c0b9dd8dadba 100644 --- a/.buildkite/scripts/hardware_ci/run-neuron-test.sh +++ b/.buildkite/scripts/hardware_ci/run-neuron-test.sh @@ -11,13 +11,14 @@ container_name="neuron_$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 10; echo)" HF_CACHE="$(realpath ~)/huggingface" mkdir -p "${HF_CACHE}" HF_MOUNT="/root/.cache/huggingface" +HF_TOKEN=$(aws secretsmanager get-secret-value --secret-id "ci/vllm-neuron/hf-token" --region us-west-2 --query 'SecretString' --output text | jq -r .VLLM_NEURON_CI_HF_TOKEN) NEURON_COMPILE_CACHE_URL="$(realpath ~)/neuron_compile_cache" mkdir -p "${NEURON_COMPILE_CACHE_URL}" NEURON_COMPILE_CACHE_MOUNT="/root/.cache/neuron_compile_cache" # Try building the docker image -aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 763104351884.dkr.ecr.us-west-2.amazonaws.com +aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws # prune old image and containers to save disk space, and only once a day # by using a timestamp file in tmp. @@ -47,6 +48,7 @@ trap remove_docker_container EXIT docker run --rm -it --device=/dev/neuron0 --network bridge \ -v "${HF_CACHE}:${HF_MOUNT}" \ -e "HF_HOME=${HF_MOUNT}" \ + -e "HF_TOKEN=${HF_TOKEN}" \ -v "${NEURON_COMPILE_CACHE_URL}:${NEURON_COMPILE_CACHE_MOUNT}" \ -e "NEURON_COMPILE_CACHE_URL=${NEURON_COMPILE_CACHE_MOUNT}" \ --name "${container_name}" \ diff --git a/tests/neuron/1_core/test_download.py b/tests/neuron/1_core/test_download.py new file mode 100644 index 000000000000..b6d91baea149 --- /dev/null +++ b/tests/neuron/1_core/test_download.py @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Load model directly +from transformers import AutoModelForCausalLM, AutoTokenizer + +def test_download(): + tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B") + model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.2-1B") From 0d0ce8834c9b582405d28bc325c1a1d8f9979b75 Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Mon, 19 May 2025 20:09:55 +0000 Subject: [PATCH 2/2] remove test_download, due to existence of 2_core/test_mistral Signed-off-by: Liangfu Chen --- tests/neuron/1_core/test_download.py | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 tests/neuron/1_core/test_download.py diff --git a/tests/neuron/1_core/test_download.py b/tests/neuron/1_core/test_download.py deleted file mode 100644 index b6d91baea149..000000000000 --- a/tests/neuron/1_core/test_download.py +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -# Load model directly -from transformers import AutoModelForCausalLM, AutoTokenizer - -def test_download(): - tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B") - model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.2-1B")