-
Notifications
You must be signed in to change notification settings - Fork 509
Open
Description
Hello!
Details
I've gotten an issue on one of my models (https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2/discussions/127) showing a discrepancy between the recommended usage snippet with the Inference Providers
import os
from huggingface_hub import InferenceClient
client = InferenceClient(
provider="hf-inference",
api_key=os.environ["HF_TOKEN"],
)
result = client.sentence_similarity(
{
"source_sentence": "That is a happy person",
"sentences": [
"That is a happy dog",
"That is a very happy person",
"Today is a sunny day"
]
},
model="sentence-transformers/all-MiniLM-L6-v2",
)
and the actual code from huggingface_hub
:
def sentence_similarity(
self, sentence: str, other_sentences: List[str], *, model: Optional[str] = None
) -> List[float]:
I suspect this is caused by this input:
huggingface.js/packages/tasks/src/snippets/inputs.ts
Lines 71 to 79 in e841a53
const inputsSentenceSimilarity = () => | |
`{ | |
"source_sentence": "That is a happy person", | |
"sentences": [ | |
"That is a happy dog", | |
"That is a very happy person", | |
"Today is a sunny day" | |
] | |
}`; |
which should likely instead be
const inputsSentenceSimilarity = () =>
`{
"sentence": "That is a happy person",
"other_sentences": [
"That is a happy dog",
"That is a very happy person",
"Today is a sunny day"
]
}`;
or
const inputsSentenceSimilarity = () =>
`sentence="That is a happy person",
other_sentences=[
"That is a happy dog",
"That is a very happy person",
"Today is a sunny day"
]`;
Depending on if the inputsSentenceSimilarity
must be json parsable.
I'm afraid I don't currently have the bandwidth to make a PR for this.
- Tom Aarsen
Metadata
Metadata
Assignees
Labels
No labels