Feature Extraction
sentence-transformers
Transformers
English
bert
sentence-similarity
mteb
inferentia2
neuron
Eval Results (legacy)
text-embeddings-inference
Instructions to use aws-neuron/bge-base-en-v1-5-seqlen-384-bs-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use aws-neuron/bge-base-en-v1-5-seqlen-384-bs-1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("aws-neuron/bge-base-en-v1-5-seqlen-384-bs-1") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Transformers
How to use aws-neuron/bge-base-en-v1-5-seqlen-384-bs-1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="aws-neuron/bge-base-en-v1-5-seqlen-384-bs-1")# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("aws-neuron/bge-base-en-v1-5-seqlen-384-bs-1") model = AutoModel.from_pretrained("aws-neuron/bge-base-en-v1-5-seqlen-384-bs-1") - Notebooks
- Google Colab
- Kaggle
Neuronx model for BAAI/bge-base-en-v1.5
This repository contains are AWS Inferentia2 and neuronx compatible checkpoint for BAAI/bge-base-en-v1.5. You can find detailed information about the base model on its Model Card.
Usage on Amazon SageMaker
coming soon
Usage with optimum-neuron
from optimum.neuron import NeuronModelForFeatureExtraction
from transformers import AutoTokenizer
import torch
import torch_neuronx
# Load Model from Hugging Face repository
model = NeuronModelForFeatureExtraction.from_pretrained("aws-neuron/bge-base-en-v1-5-seqlen-384-bs-1")
tokenizer = AutoTokenizer.from_pretrained("aws-neuron/bge-base-en-v1-5-seqlen-384-bs-1")
# sentence input
inputs = "Hello, my dog is cute"
# Tokenize sentences
encoded_input = tokenizer(inputs,return_tensors="pt",truncation=True,max_length=model.config.neuron["static_sequence_length"])
# Compute embeddings
with torch.no_grad():
model_output = model(*tuple(encoded_input.values()))
# Perform pooling. In this case, cls pooling.
sentence_embeddings = model_output[0][:, 0]
# normalize embeddings
sentence_embeddings = torch.nn.functional.normalize(sentence_embeddings, p=2, dim=1)
input_shapes
{
"sequence_length": 384,
"batch_size": 1
}
- Downloads last month
- 161
Spaces using aws-neuron/bge-base-en-v1-5-seqlen-384-bs-1 11
🥇
mteb/leaderboard_legacy
🥇
sq66/leaderboard_legacy
🚀
reader-1/1
🥇
shiwan7788/leaderboard-uni
🥇
SmileXing/leaderboard
Evaluation results
- accuracy on MTEB AmazonCounterfactualClassification (en)test set self-reported76.149
- ap on MTEB AmazonCounterfactualClassification (en)test set self-reported39.323
- f1 on MTEB AmazonCounterfactualClassification (en)test set self-reported70.169
- accuracy on MTEB AmazonPolarityClassificationtest set self-reported93.387
- ap on MTEB AmazonPolarityClassificationtest set self-reported90.213
- f1 on MTEB AmazonPolarityClassificationtest set self-reported93.377
- accuracy on MTEB AmazonReviewsClassification (en)test set self-reported48.846
- f1 on MTEB AmazonReviewsClassification (en)test set self-reported48.146