Hello, headers = {“Authorization”: f"Bearer "} def query(payload): data = query({“inputs”: “writing, painting, or printing signs or show cards used for display or other purposes.”}) print (data) The error that I get is as follows: Could you please help me out here? Thanks in advance
I was trying to use the inference api to extract features of sentences. However I am getting an error.
this is my code:
API_URL = “/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2Fsentence-transformers%2Fmulti-qa-mpnet-base-dot-v1%3C%2Fa%3E%E2%80%9D%3C%2Fp%3E
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
{‘error’: ['SentenceSimilarityInputsCheck expected dict not list: __root__ in parameters']}
I had this same issue. It appears in the model hub some of the sentence-transformer API endpoints are set up for sentence similarity while others are set up for feature extraction. Passing the query as you have there to a sentence similarity endpoint results in an error. Try using a different model with a feature extraction endpoint like: Craig/paraphrase-MiniLM-L6-v2 or julien-c/distilbert-feature-extraction
adding this response here for context
it worked for me, thanks
1 Like