From 459ed834423222af97ba922d51b42e34f0cd158d Mon Sep 17 00:00:00 2001 From: Ajay Vohra Date: Fri, 4 Apr 2025 04:04:08 +0000 Subject: [PATCH] add non-interactive authentication --- src/neuronx_distributed/scripts/checkpoint_converter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/neuronx_distributed/scripts/checkpoint_converter.py b/src/neuronx_distributed/scripts/checkpoint_converter.py index d7c1329..cbffcb6 100644 --- a/src/neuronx_distributed/scripts/checkpoint_converter.py +++ b/src/neuronx_distributed/scripts/checkpoint_converter.py @@ -76,7 +76,9 @@ def download_and_save_hf_model(self, model_identifier, output_path="/home/ubuntu from transformers import AutoModelForCausalLM - token = getpass("Enter your Hugging Face API token: (If you don't have one, create it at https://huggingface.co/settings/tokens): ") + token = os.getenv("HF_TOKEN", None) + if token is None: + token = getpass("Enter your Hugging Face API token: (If you don't have one, create it at https://huggingface.co/settings/tokens): ") login(token=token) print(f"Downloading model: {model_identifier}")