Base model: BAAI/bge-base-en-v1.5
This repository is an Ascend NPU adaptation of BGE base English v1.5 for sentence embedding. Verified on Ascend 910B (npu:0) with CPU-NPU consistency cosine >= 0.999.
BertModel (bert, 12 layers, hidden 768, 109M params)pooling_mode_cls_token=true) + L2 normalizeDevice proof logged: model parameters on npu:0, input_ids/attention_mask on npu:0, output embeddings on npu:0.
from inference import load_model, encode
tokenizer, model, device = load_model() # auto selects npu:0 if available
sentences = ["What is the capital of France?", "Paris is the capital of France."]
embeddings = encode(sentences, tokenizer, model, device)
print(embeddings.shape) # [2, 768]Or run directly:
python inference.pynext(model.parameters()).device == npu:0, all tensors on npu:0torch>=2.0
torch_npu
transformers>=4.30.0
sentence-transformers
numpy
