Sentence Similarity
sentence-transformers
PyTorch
TensorFlow
Rust
ONNX
Safetensors
Transformers
English
bert
feature-extraction
Inference Endpoints
text-embeddings-inference
5 papers

Upload ONNX weights exported via optimum with `library='sentence-transformers'`

#64
by Xenova HF staff - opened

Command ran:

optimum-cli export onnx --model sentence-transformers/all-MiniLM-L6-v2 ./sbert/

Output:

Validating ONNX model sbert/model.onnx...
        -[βœ“] ONNX model output names match reference model (sentence_embedding, token_embeddings)
        - Validating ONNX Model output "token_embeddings":
                -[βœ“] (2, 16, 384) matches (2, 16, 384)
                -[βœ“] all values close (atol: 1e-05)
        - Validating ONNX Model output "sentence_embedding":
                -[βœ“] (2, 384) matches (2, 384)
                -[βœ“] all values close (atol: 1e-05)

Note: This is slightly different to https://huggingface.co/Xenova/all-MiniLM-L6-v2. That model has the last_hidden_state output name, whereas this model has token_embeddings and sentence_embedding.

btw I reverted newly-exported tokenizer and config files to keep diff small and just in case there are backwards-compatibility issues (there shouldn't be though).

@Xenova does optimum-cli export onnx also work if you have a fine trained setfit models?

when i use the huggingface setfit library to export to onnx i see:
Screenshot 2024-05-25 at 6.05.47β€―PM.png

what is token_embeddings and sentence_embedding? where is the predicted label in token_embeddings or sentence_embedding?

tomaarsen changed pull request status to merged

Sign up or log in to comment