I get " HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/Whisper%20Small%20manju%20Mal/resolve/main/config.json"
Did you solve your problem.
pls help
I get " HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/Whisper%20Small%20manju%20Mal/resolve/main/config.json"
Did you solve your problem.
pls help
You may need to set a token for the model e processor.
Hi, @Deepakkori45
You must generate a âwriteâ token under your access tokens page
then, filling that token by below cli command
huggingface-cli login
model = AutoModelForCausalLM.from_pretrained(
âmeta-llama/Llama-2-7b-hfâ,
token=ââ
)
try passing your token here it works like a charm
This worked for me
Pass token as an extra arg. (..., token=hf_token)
Source: User access tokens
Greate!!! it works for me.
I want to create a Server-less inference endpoint from a model directly from the HUB. I have already accepted the model conditions. Here is the code I am using (reference):
import pandas as pd
import boto3
import sagemaker
import time
import json
import io
from io import StringIO
import base64
import re
import os
from sagemaker.image_uris import retrieve
from sagemaker.huggingface import HuggingFaceModel
import sagemaker
from huggingface_hub import login
login(token = os.environ["HUGGING_FACE_READ_TOKEN"],add_to_git_credential=True)
sess = sagemaker.Session()
region = sess.boto_region_name
s3_client = boto3.client("s3", region_name=region)
sm_client = boto3.client("sagemaker", region_name=region)
sm_runtime_client = boto3.client("sagemaker-runtime")
sagemaker_role = sagemaker.get_execution_role()
model_name = "llama-3-1-8B"
hub = {
'HF_MODEL_ID':'meta-llama/Meta-Llama-3.1-8B', # model_id from hf.co/models
'HF_TASK':'question-answering', # NLP task you want to use for predictions
'HF_API_TOKEN':os.environ["HUGGING_FACE_READ_TOKEN"],
}
# create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
env=hub,
role=sagemaker_role, # iam role with permissions to create an Endpoint
transformers_version="4.6", # transformers version used
pytorch_version="1.7", # pytorch version used
py_version="py36", # python version of the DLC
name = model_name
)
predictor = huggingface_model.deploy(
# initial_instance_count=1,
# instance_type="ml.m5.xlarge",
container_startup_health_check_timeout=300,
serverless_inference_config=sagemaker.serverless.ServerlessInferenceConfig(memory_size_in_mb=4096,max_concurrency= 1)
)
I have tested with different permission set tokens but not to avail, the error seems to be related to a specific config file of the model:
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/meta-llama/Meta-Llama-3.1-8B/resolve/main/config.json
Python Version:
3.10.14
Sagemaker Version:
2.224.4
Let me know if I should post this issue on AWS instead. I want to use this option if possible or do I have to download the model and create a tar.gz to deploy it?
@afelipetu what kind of token did you create? is it a âreadâ token, or a fine-grained token (the default)? if the latter, you need to make sure to give the permission labeled âRead access to contents of all public gated repos you can accessâ
It is the default read permission, but the problem was that I only got the mail permissions for the 70B model. Even though the model I asked permission for was the 8B, the page says I have permission for it but it doesnât work. Anyway, with 70B I can deploy, thanks.
this solved my problem. for the learners out there like me, go to the huggingface tokens page, create a new token, select fine-grained, scroll down and search the specific model you want to access. copy the token and paste it in this command
huggingface-cli login --token (your_token_here) --add-to-git-credential
Prediction failed.
401 Client Error. (Request ID: Root=1-672c8e43-4ece72fe35901b7237d6c0aa;4c69e68c-639c-4618-88cc-1df28b2e3717) Repository Not Found for url: https://huggingface.co/api/models/DjDax/Dax. Please make sure you specified the correct repo_id
and repo_type
. If you are trying to access a private or gated repo, make sure you are authenticated. Invalid username or password.
I am receiving this error how do i resolve?
Your request doesnât appear to have been authenticated, hence the 401 error. Either you didnât pass the token, or the token passed was invalid.
Its also work for me, thanks you very much!