Trying huggingface API Failed, please help.

#1
by forhonourlx - opened
import requests

API_URL = "https://api-inference.huggingface.co/models/SkyWork/SkyCode"
headers = {"Authorization": "Bearer hf_........................................."}

def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    return response.json()
    
output = query({
    "inputs": "if __name__ == ",
})
print(output)

{'error': "Can't load tokenizer using from_pretrained, please update its configuration: Loading SkyWork/SkyCode requires you to execute the tokenizer file in that repo on your local machine. Make sure you have read the code there to avoid malicious use, then set the option trust_remote_code=True to remove this error."}

Sorry, current the Sky models are not available via hugging-face API. Feel Free to Get the model parameters via:

from transformers import GPT2LMHeadModel
from transformers import AutoTokenizer
model = GPT2LMHeadModel.from_pretrained("SkyWork/SkyCode")
tokenizer = AutoTokenizer.from_pretrained("SkyWork/SkyCode", trust_remote_code=True)

Sign up or log in to comment