Feature extraction using Inference API error
Hello,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 = “https://api-inference.huggingface.co/models/sentence-transformers/multi-qa-mpnet-base-dot-v1”headers = {“Authorization”: f"Bearer"}def query(payload):response = requests.post(API_URL, headers=headers, json=payload)

return response.json()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:{‘error’: ['SentenceSimilarityInputsCheck expected dict not list:__root__inparameters']}Could you please help me out here?Thanks in advance
2022-07-28T15:30:22Z
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-v2orjulien-c/distilbert-feature-extraction
2023-05-16T00:34:25Z
adding this response here for contextSentenceSimilarityInputsCheck expected dict not list: `__root__` in `parameters`BeginnersHi@Denaldo, 
Our API Inference supports multiple tasks. For certain models, we provide a straightforward abstraction for embedding similarity, such as with sentences. The tag and/or pipeline_tag establishes the correct task on the API Inference backend for all compatible models on our hub. 
When using sentence-similarity, the backend establishes a sentence similarity pipeline. It expects multiple sentence inputs, which will subsequently be transformed into embeddings and compared through cosine…
2024-12-15T11:56:40Z
it worked for me, thanks