Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model: distilbert-base-uncased
|
| 4 |
+
tags:
|
| 5 |
+
- text-classification
|
| 6 |
+
- tabular-classification
|
| 7 |
+
- multimodal
|
| 8 |
+
- erp
|
| 9 |
+
- accounting
|
| 10 |
+
- pytorch
|
| 11 |
+
pipeline_tag: text-classification
|
| 12 |
+
widget:
|
| 13 |
+
- text: "[VENDOR] Amazon Services [DESC] Dell UltraSharp 27 USB-C Monitor"
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# ERP GL Account Classifier
|
| 17 |
+
|
| 18 |
+
Multimodal classifier for ERP GL account classification. Achieves **90.8% test accuracy** by learning from:
|
| 19 |
+
- Text: vendor + description
|
| 20 |
+
- Numerical: transaction amount + log(amount)
|
| 21 |
+
- Categorical: department embeddings
|
| 22 |
+
|
| 23 |
+
## Model Details
|
| 24 |
+
|
| 25 |
+
- **Base model**: DistilBERT (distilbert-base-uncased)
|
| 26 |
+
- **Architecture**: 3-branch fusion (text 768-d + numerical 64-d + categorical 32-d)
|
| 27 |
+
- **Parameters**: 66.6M (all trainable)
|
| 28 |
+
- **Training data**: 659 samples (synthetic ERP transactions)
|
| 29 |
+
- **Test accuracy**: 90.8%
|
| 30 |
+
- **Test F1**: 90.6%
|
| 31 |
+
|
| 32 |
+
## Usage
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
import json
|
| 36 |
+
import numpy as np
|
| 37 |
+
import torch
|
| 38 |
+
from pathlib import Path
|
| 39 |
+
from transformers import AutoTokenizer, AutoConfig
|
| 40 |
+
from huggingface_hub import hf_hub_download
|
| 41 |
+
|
| 42 |
+
# Download auxiliary files
|
| 43 |
+
scaler_path = hf_hub_download(repo_id="EHTB/erp-classifier-dataset", filename="scaler.json", repo_type="dataset")
|
| 44 |
+
vocab_path = hf_hub_download(repo_id="EHTB/erp-classifier-dataset", filename="dept_vocab.json", repo_type="dataset")
|
| 45 |
+
|
| 46 |
+
with open(scaler_path) as f:
|
| 47 |
+
scaler_params = json.load(f)
|
| 48 |
+
scaler_mean = np.array(scaler_params['mean'])
|
| 49 |
+
scaler_scale = np.array(scaler_params['scale'])
|
| 50 |
+
|
| 51 |
+
with open(vocab_path) as f:
|
| 52 |
+
dept_vocab = json.load(f)['dept2id']
|
| 53 |
+
|
| 54 |
+
# Load model (requires custom ERPClassifierModel class)
|
| 55 |
+
# See: https://github.com/yourusername/erp-classifier/blob/main/src/model.py
|
| 56 |
+
|
| 57 |
+
tokenizer = AutoTokenizer.from_pretrained("EHTB/erp-classifier")
|
| 58 |
+
config = AutoConfig.from_pretrained("EHTB/erp-classifier")
|
| 59 |
+
|
| 60 |
+
# Note: This model uses a custom architecture (ERPClassifierModel).
|
| 61 |
+
# You need to import the model class from the repository to load weights.
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
## Training Procedure
|
| 65 |
+
|
| 66 |
+
- **Optimizer**: AdamW (lr=3e-5, weight_decay=0.01)
|
| 67 |
+
- **Warmup**: 10% of training steps
|
| 68 |
+
- **Batch size**: 16
|
| 69 |
+
- **Epochs**: 10 (early stopping patience=5)
|
| 70 |
+
- **Loss**: CrossEntropyLoss
|
| 71 |
+
- **Training time**: ~3 minutes (Apple M1/M2)
|
| 72 |
+
|
| 73 |
+
## Performance
|
| 74 |
+
|
| 75 |
+
| GL Account | F1 Score | Support |
|
| 76 |
+
|------------|----------|---------|
|
| 77 |
+
| GL_6410_FACILITY_PANTRY | 100% | 18 |
|
| 78 |
+
| GL_6450_CLEANING_MAINTENANCE | 100% | 19 |
|
| 79 |
+
| GL_6400_OFFICE_CONSUMABLES | 96.8% | 15 |
|
| 80 |
+
| GL_6250_TECH_BOOKS_TRAINING | 95.0% | 19 |
|
| 81 |
+
| GL_6150_MARKETING_PROMO | 94.1% | 18 |
|
| 82 |
+
| GL_6310_WORKPLACE_SAFETY_ERGONOMICS | 91.9% | 19 |
|
| 83 |
+
| GL_1400_IT_HARDWARE_CAPEX | 79.1% | 19 |
|
| 84 |
+
| GL_6220_IT_PERIPHERALS_OPEX | 64.0% | 15 |
|
| 85 |
+
|
| 86 |
+
## Limitations
|
| 87 |
+
|
| 88 |
+
- Trained on synthetic data (942 samples)
|
| 89 |
+
- GL_6220 (IT peripherals < 800 EUR) has lower accuracy due to limited training examples
|
| 90 |
+
- Requires custom model class (not compatible with standard AutoModelForSequenceClassification)
|
| 91 |
+
|
| 92 |
+
## Citation
|
| 93 |
+
|
| 94 |
+
```bibtex
|
| 95 |
+
@misc{erp-classifier,
|
| 96 |
+
title={ERP GL Account Classifier},
|
| 97 |
+
author={Your Name},
|
| 98 |
+
year={2024},
|
| 99 |
+
publisher={HuggingFace},
|
| 100 |
+
howpublished={\url{https://huggingface.co/EHTB/erp-classifier}}
|
| 101 |
+
}
|
| 102 |
+
```
|