Download source/examples/quickstart.py from DeepEduVN/bungpt-open: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/DeepEduVN/bungpt-open/resolve/main/source/examples/quickstart.py
- Command line
-
hf download hf://DeepEduVN/bungpt-open/source/examples/quickstart.py
-
curl -L -o quickstart.py https://huggingface.co/DeepEduVN/bungpt-open/resolve/main/source/examples/quickstart.py
1.12 kB
| """Score two questions about one state with BunGPT-DeepEdu-Decision-4B-Open. | |
| python examples/quickstart.py --model <path or hub id> | |
| """ | |
| import argparse | |
| import json | |
| from deepedu_decision import DecisionModel | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--model", required=True, help="local checkpoint directory or Hugging Face Hub repo id") | |
| parser.add_argument("--device", default="cuda:0") | |
| args = parser.parse_args() | |
| model = DecisionModel.from_pretrained(args.model, device=args.device) | |
| state = "Customer message: 'I was charged twice for my March invoice and need one of the charges reversed.'" | |
| questions = { | |
| "route": { | |
| "type": "choice", | |
| "instructions": "Which team should handle this message?", | |
| "criteria": { | |
| "billing": "Charges, invoices, refunds", | |
| "technical": "Bugs, outages, how-to questions", | |
| "sales": "New purchases, pricing, upgrades", | |
| }, | |
| }, | |
| "urgent": {"type": "noul", "instructions": "Does the customer ask for immediate action?"}, | |
| } | |
| out = model.decide(state, questions) | |
| print(json.dumps(out, indent=2)) | |