Downloads · 30 days
89
0% of all-time downloads
aws-neuron/bge-base-en-v1-5-seqlen-384-bs-1
bge-base-en-v1-5-seqlen-384-bs-1 is a feature extraction model from aws-neuron. Use it when you need embeddings to search or compare text. It is set up for sentence-transformers. The card lists the license as mit.
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.
Downloads · 30 days
89
0% of all-time downloads
All-time downloads
33.9K
Public
Repo size
710 MB
Likes
1
Public
Click a slice to open those files.
.neuron274 MB · 100%
From the Hugging Face model README
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.
coming soon
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
}