w
gcw_uQ09W7jl/SampurNER-Bengali-MuRIL-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

SampurNER Bengali MuRIL – Ascend NPU

Model: prachuryyaIITG/SampurNER_Bengali_MuRIL
Task: Fine-grained Bengali Named Entity Recognition (Few-NERD 133 labels)
Base: google/muril-large-cased (BertForTokenClassification, 24 layers, hidden 1024, vocab 197285)
Hardware: Huawei Ascend 910B npu:0 via torch_npu
Route: token-classification – logits → argmax → word_ids aggregation → span decode

Evidence

agent workflow npu device call model result

Inference

pip install -r requirements.txt
python inference.py

inference.py loads weights from local ./sampur_model (downloaded via HF_ENDPOINT=https://hf-mirror.com), runs Bengali sentences:

  • রবীন্দ্রনাথ ঠাকুর কলকাতায় জন্মগ্রহণ করেন।
  • শেখ হাসিনা ঢাকায় বাংলাদেশের প্রধানমন্ত্রী হিসেবে দায়িত্ব পালন করছেন।
  • সচিন তেন্ডুলকর মুম্বাইয়ে জন্মগ্রহণ করেছিলেন এবং ভারতের হয়ে ক্রিকেট খেলেছেন।

It prints device proofs (next(model.parameters()).device, input_ids.device, logits.device), span results, and performance (sentences/s after torch.npu.synchronize()).

Validation

  • CPU vs NPU spans identical: [(রবীন্দ্রনাথ ঠাকুর, person-artist/author), (কলকাতায়, location-GPE)] etc.
  • Token ids: CPU and NPU argmax ids exactly match (e.g., [132, 50, 116, 20, ...])
  • Logits max diff: ~0.025 (fp32, NPU matmul order), mean ~0.003, but span/pred identical → PASS
  • Performance: NPU ~81 sentences/s vs CPU ~2.9 sentences/s (batch 1, 10 runs x 3 texts)
  • Device: npu:0 Ascend910_9362, free HBM ~60 GiB

References

  • Model card: https://huggingface.co/prachuryyaIITG/SampurNER_Bengali_MuRIL
  • SampurNER dataset: https://huggingface.co/datasets/prachuryyaIITG/SampurNER