Downloads · 30 days
9
20% of all-time downloads
EmbeddedLLM/bge-large-en-v1.5-onnx-o4-gpu
bge-large-en-v1.5-onnx-o4-gpu is a feature extraction model from EmbeddedLLM. Use it when you need embeddings to search or compare text. It is set up for transformers. The card lists the license as mit.
- ONNX model for GPU with O4 optimisation - We exported the model with userawattentionmask=True due to this issue
Downloads · 30 days
9
20% of all-time downloads
All-time downloads
46
Public
Repo size
669 MB
Likes
0
Public
Click a slice to open those files.
.onnx668 MB · 100%
From the Hugging Face model README
use_raw_attention_mask=True due to this issueimport torch.nn.functional as F
from optimum.onnxruntime import ORTModelForFeatureExtraction
from transformers import AutoTokenizer
sentences = [
"The llama (/ˈlɑːmə/) (Lama glama) is a domesticated South American camelid.",
"The alpaca (Lama pacos) is a species of South American camelid mammal.",
"The vicuña (Lama vicugna) (/vɪˈkuːnjə/) is one of the two wild South American camelids.",
]
model_name = "EmbeddedLLM/bge-large-en-v1.5-onnx-o4-gpu"
device = "cuda"
provider = "CUDAExecutionProvider"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = ORTModelForFeatureExtraction.from_pretrained(
model_name, use_io_binding=True, provider=provider, device_map=device
)
inputs = tokenizer(
sentences,
padding=True,
truncation=True,
return_tensors="pt",
max_length=model.config.max_position_embeddings,
)
inputs = inputs.to(device)
embeddings = model(**inputs).last_hidden_state[:, 0]
embeddings = F.normalize(embeddings, p=2, dim=1)
print(embeddings.cpu().numpy().shape)