Text Classification
Transformers
Safetensors
English
decision-model
typed-decisions
calibration
opendecide
Instructions to use mvbalaji/od1-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mvbalaji/od1-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="mvbalaji/od1-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mvbalaji/od1-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download example.py from mvbalaji/od1-base: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/mvbalaji/od1-base/resolve/main/example.py
- Command line
-
hf download hf://mvbalaji/od1-base/example.py
-
curl -L -o example.py https://huggingface.co/mvbalaji/od1-base/resolve/main/example.py
1.24 kB
| """Minimal OD-1 usage (GPU recommended; CPU works but is slow). pip install torch transformers""" | |
| import json | |
| import os | |
| import sys | |
| HERE = os.path.dirname(os.path.abspath(__file__)) # abspath, not realpath: the Hub cache uses symlinks | |
| sys.path.insert(0, HERE) | |
| from od1.model import OD1Model # noqa: E402 | |
| m = OD1Model.load(HERE, dtype="bf16", device="cuda") # or dtype="fp32", device="cpu" | |
| m.enable_cuda_graphs() # optional (GPU): fastest serving path | |
| state = json.dumps({"ticket_id": "T-4821", "customer_tier": "gold", "message": "Hi, I was charged twice for my March invoice (INV-2291, $149 each). Please refund the duplicate today, this is the second time it has happened."}) | |
| print(json.dumps(m.answer(state, {"route": {"type": "choice", "instructions": "Which team should handle this ticket?", "criteria": {"billing": "payments, invoices, refunds", "tech_support": "product bugs", "sales": "new purchases", "account": "login and access"}}, "refund": {"type": "noul", "instructions": "Is the customer asking for a refund?"}, "urgency": {"type": "score", "instructions": "How urgent is this ticket?", "criteria": ["can wait a week", "within a few days", "today", "immediately"]}}), indent=1)) | |