I keep receiving 503 error when using HuggingFaceEndpoint to access the model

#154
by CinderLord - opened

Here're my codes:

import os
import warnings
from urllib3.exceptions import NotOpenSSLWarning
from langchain_huggingface import HuggingFaceEndpoint
import sys

warnings.filterwarnings("ignore", category=NotOpenSSLWarning)
os.environ["HUGGINGFACEHUB_API_TOKEN"] = '....'
llm = HuggingFaceEndpoint(
repo_id="meta-llama/Llama-3.2-3B-Instruct",
timeout=60
)

def explain_code(code):
base_prompt = """
Tell me about the flower
"""
prompt = base_prompt + code
completion = llm.invoke(prompt)
return completion

if name == "main":
code = """rose"""
result = explain_code(code)
print(result)

But I got the error as follows:

raise HTTPError(http_error_msg, response=self)

requests.exceptions.HTTPError: 503 Server Error: Service Temporarily Unavailable for url: https://router.huggingface.co/hf-inference/models/meta-llama/Llama-3.2-3B-Instruct

Please could someone tell me how to fix the problem?
Thanks!!!

CinderLord changed discussion title from Why I keep receiving 503 error when using HuggingFaceEndpoint to access the model? to Why I kept receiving 503 error when using HuggingFaceEndpoint to access the model?
CinderLord changed discussion title from Why I kept receiving 503 error when using HuggingFaceEndpoint to access the model? to I keep receiving 503 error when using HuggingFaceEndpoint to access the model?
CinderLord changed discussion title from I keep receiving 503 error when using HuggingFaceEndpoint to access the model? to I keep receiving 503 error when using HuggingFaceEndpoint to access the model

Please could someone tell me how to fix it? Or is there any available Llama model that I can replace with? I'm struggling under a deadline...

Please could someone tell me how to fix it? Or is there any available Llama model that I can replace with? I'm struggling under a deadline...

Just change to:
client = InferenceClient("meta-llama/Llama-3.1-8B-Instruct")

@helmo thanks. it worked

Sign up or log in to comment