I encountered the same problem, I also received such error when downloading llama2. But I got an email telling me I was logged into huggingface.
Will you let me know if you find a solution?
The 401 Unauthorized error indicates that the URL requires authentication. You need to provide your Hugging Face credentials (API token) to access the file. You can use wget with an authorization header to include your Hugging Face API token. Here’s how to do it:
Obtain your Hugging Face API token from your account settings on the Hugging Face website.
Use the wget command with the --header option to include your token:
Just in case anyone is still coming here like I did and is confused because even when using the afore mentioned API header method, your command is now returning 403 Forbidden:
Make sure you give the API token access to your repositories.
One could add this to their bashrc, like I did, to simpliy things up:
hfget() {
if [ -z "$1" ]; then
echo "Error: URL argument is required."
echo "Usage: hfget <URL>"
return 1
fi
if [ -z "$HF_TOKEN" ]; then
echo "Error: HF_TOKEN environment variable is not set."
return 1
fi
local url="$1"
local filename=$(basename "$url")
echo "Downloading $filename from Hugging Face..."
wget --header="Authorization: Bearer $HF_TOKEN" "$url" -O "$filename"
if [ $? -eq 0 ]; then
echo "Successfully downloaded $filename"
else
echo "Failed to download $filename"
fi
}
You should have an export HF_TOKEN in the same file for this to work.