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.1

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

Built distribution (wheel)

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

Total release size: 42.7 kB

Release files / banking_nlu-0.1.1.tar.gz

Download URL banking_nlu-0.1.1.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
270a98f725b741b3c45c4d64baca88ce98d98f2d658457ded85e705e38e242e0
BLAKE2b-256 checksum
How to use checksums
692c44857dac65fc2d363aaf3e930db39b45b731704a040a1d890bdb331f89a6
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.1-py3-none-any.whl

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

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