Instructions to use Saeedhoj/spendcoder-distilroberta with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Saeedhoj/spendcoder-distilroberta with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Saeedhoj/spendcoder-distilroberta")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Saeedhoj/spendcoder-distilroberta") model = AutoModelForSequenceClassification.from_pretrained("Saeedhoj/spendcoder-distilroberta", device_map="auto") - Notebooks
- Google Colab
- Kaggle
SpendCoder: purchase line to spend category
Fine-tuned distilroberta-base that reads a short purchase or invoice line (for example "ANNUAL MAINTENANCE OF HV SWITCHGEAR") and returns one of 14 spend categories, with a confidence score. Low-confidence lines are meant to go to a person. Code, data preparation and tests: https://github.com/saeedm31/SpendCoder
Results (test year, contracts the model never saw)
| Model | Accuracy | Macro F1 | Weighted F1 |
|---|---|---|---|
| TF-IDF + logistic regression (baseline) | 0.673 | 0.616 | 0.675 |
| Fine-tuned distilroberta-base | 0.665 | 0.569 | 0.664 |
At the chosen review threshold (0.99), 29.0% of test lines are coded automatically with 91.3% accuracy; the rest go to a person.
Train: 17,098 lines (contracts starting before Oct 2023). Validation: 2,065 (Oct 2023 to Sep 2024). Test: 1,547 (from Oct 2024). Test lines whose exact text appears in training were removed.
Categories
- Engineering & professional services
- Research & development
- Facility operations & management
- Construction & building maintenance
- Equipment maintenance & repair
- IT & telecom services
- Environmental services
- Utilities, security & housekeeping
- Other services
- IT hardware & software
- Electrical & power equipment
- Lab instruments & chemicals
- Vehicles & machinery
- Other goods
Data
US Department of Energy contract descriptions and their Product and Service Codes from USAspending.gov (public domain), grouped into the 14 categories above.
Use
Suggest a spend category for purchase and invoice lines in accounts payable or procurement; send lines below the review threshold to a person. Not for automatic posting without review. Trained on one public-sector buyer's wording: before using it in another company, check it on that company's labelled lines and fine-tune further.
Files
- PyTorch / Transformers weights at the repo root:
AutoModelForSequenceClassification.from_pretrained(...) onnx/:model.onnx,tokenizer.json,spendcoder.json(labels, review threshold) for CPU serving with onnxruntime, no PyTorch needed
- Downloads last month
- 53
Model tree for Saeedhoj/spendcoder-distilroberta
Base model
distilbert/distilroberta-base