Ascend 910B NPU-adapted version of WhereIsAI/UAE-Large-V1 (BertModel, 24 layers, 1024 hidden, 335M params, 1024-dim embedding, CLS pooling).
Validated on single-card Ascend 910B (npu:0) with torch_npu eager inference — no graph compilation required.
WhereIsAI/UAE-Large-V1 (BertModel, model_type: bert, 24 layers, hidden 1024, 16 heads, vocab 30522)BertModel without task head (embedding route)1_Pooling/pooling_mode_cls_token: true) + L2 normalize (sentence-transformers Transformer→Pooling→Normalize)model.safetensors 1.34 GB (fp32)BertTokenizer (vocab.txt 30522)AutoModel.from_pretrained(..., torch_dtype=float32).to("npu:0") — fp32 preserves 0.999+ cosine vs CPUBertTokenizer from local dir, padding=True, truncation=True, max_length=512last_hidden_state[:,0] then F.normalize(p=2) — attention_mask kept for padding correctnessinput_ids, attention_mask, last_hidden_state, embeddings) verified on npu:0; torch.npu.synchronize() around timingnext(model.parameters()).device, input_ids.device, last_hidden_state.device, embeddings.device all npu:0from transformers import AutoModel, AutoTokenizer
import torch, torch_npu, torch.nn.functional as F
model_dir = "WhereIsAI/UAE-Large-V1"
tok = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=False)
model = AutoModel.from_pretrained(model_dir, trust_remote_code=False).to("npu:0").eval()
sentences = ["The cat sits on the mat.", "A cat is sitting on a mat."]
enc = tok(sentences, padding=True, truncation=True, max_length=512, return_tensors="pt")
enc = {k: v.to("npu:0") for k,v in enc.items()}
with torch.no_grad():
out = model(**enc)
emb = F.normalize(out.last_hidden_state[:,0], p=2, dim=1) # [2, 1024]
torch.npu.synchronize()
print(emb.device) # npu:0
print(F.cosine_similarity(emb[0].unsqueeze(0), emb[1].unsqueeze(0)).item()) # ~0.988Or run python inference.py.

See requirements.txt. Tested with torch 2.9.0, torch_npu 2.9.0.post1, transformers >=4.30.