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.1.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.1.0
File Size Uploaded Provenance
banking_nlu-0.1.0.tar.gz 19.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 42.7 kB

Release files / banking_nlu-0.1.0.tar.gz

Download URL banking_nlu-0.1.0.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
60ea7f0a1d8dca8a2c91dce370cc30fc15e450bd7855018ee862df270089bc85
BLAKE2b-256 checksum
How to use checksums
7a82da1c323309fce2af4e9c58e0d4d8b9fc764005efc39affbf23d8b31623af
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.1.0-py3-none-any.whl

Download URL banking_nlu-0.1.0-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c575d7f9e673a5210e457df41fe957a7378ad2ffb77e38ae04ce289d54cd8b93
BLAKE2b-256 checksum
How to use checksums
d73d7d3fc754b6d2022792d1165d3b421063434f64e143e2894fd9ccfa52d550
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.1.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