Skip to main content

Banking NLU Model Library Guide

Overview

banking-nlu is an inference library for the Banking NLU model.

The project internally supports training multiple model versions, but this library exposes the released model for prediction.

The model supports:

  • Intent classification
  • Named Entity Recognition (NER)
  • Structured prediction output

The current model is based on:

  • Transformer: XLM-RoBERTa
  • Tasks:
    • Multi-label intent classification
    • Token-level entity extraction

Installation

Install the library using pip:

pip install banking-nlu

Required Files

The predictor requires:

  1. Trained model files
  2. Intent metadata
  3. Entity metadata

The directory structure should look like:

model/
├── model.pt
├── tokenizer/
│   ├── tokenizer.json
│   ├── tokenizer_config.json
│   └── sentencepiece.bpe.model
│
metadata/
├── intents.json
└── entities.json

Download Metadata

Download the required metadata files:

  • intents.json
  • entities.json

from:

https://github.com/yewontaung/atcm-banking-nlu-pipeline/tree/main/metadata

These files are required to map model output indexes into readable intent and entity labels.


Download Trained Model

Download the trained model artifact from:

<Model download location>

After downloading, extract the model files.

Example:

saved_models/
└── banking_nlu_model_v1/
    ├── model.pt
    └── tokenizer/
        ├── tokenizer.json
        ├── tokenizer_config.json
        └── sentencepiece.bpe.model

Creating Predictor

from banking_nlu import BankingNLUPredictor


predictor = BankingNLUPredictor.model_predictor(
    model_name="xlm-roberta-base",
    saved_model_path="./saved_models/banking_nlu_model_v1",
    intent_metadata_path="./metadata/intents.json",
    entity_metadata_path="./metadata/entities.json",
    device="cpu",
)

Parameters

Parameter Description
model_name Base transformer model name
saved_model_path Path to trained model directory
intent_metadata_path Path to intent mapping metadata
entity_metadata_path Path to entity mapping metadata
device Inference device (cpu or cuda)

Using Predictor

text = "အောင်အောင်ကို ၇၀၀၀၀ လွှဲလိုက်ပါ"

result = predictor.predict(text)

print(result)

Prediction Result

The prediction result will have the following structure:

{
    "text": "အောင်အောင်ကို ၇၀၀၀၀ လွှဲလိုက်ပါ",
    "intents": [
        {
            "label": "transfer_money",
            "confidence": 0.966,
            "entities": [
                {
                    "label": "receiver",
                    "value": "အောင်အောင်"
                },
                {
                    "label": "amount",
                    "value": "၇၀၀၀၀"
                }
            ]
        }
    ]
}

Inference Pipeline

The library internally performs:

Input Text

    |
    v

Tokenizer

    |
    v

XLM-RoBERTa Model

    |
    v

Intent & Entity Logits

    |
    v

Logits Mapping

    |
    v

Entity Binding

    |
    v

Structured Prediction Result

Notes

  • The Python package contains only inference code.
  • Model weights are distributed separately because of their large size.
  • Metadata files must match the trained model version.
  • The same tokenizer used during training must be used during inference.
  • Different model versions may provide different prediction results.

Metadata

Release files for banking-nlu 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for banking-nlu 0.2.0
File Size Uploaded Provenance
banking_nlu-0.2.0.tar.gz 22.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for banking-nlu 0.2.0
File Interpreter ABI Platform
banking_nlu-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.1 kB

Release files / banking_nlu-0.2.0.tar.gz

Download URL banking_nlu-0.2.0.tar.gz
Size 22.8 kB
Tags Source
SHA-256 checksum
How to use checksums
daba96c76a164e8d757dd027e38a24f0bf92546cfbcdc2cdd078acdf2495091c
BLAKE2b-256 checksum
How to use checksums
2a78264d00ef86ee72cb14dcd289754e73d88e51c69f74ef7294c08938c6f1d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / banking_nlu-0.2.0-py3-none-any.whl

Download URL banking_nlu-0.2.0-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbe30f968b64a1e23baf798c0eba480f71073869811d417ea6c5eedd755fc0f0
BLAKE2b-256 checksum
How to use checksums
2948aedb2fdb3227282138fd81a79ca6ea63c9db00fd22f85704bc435ce543e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for banking-nlu 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page