Download example.py from jc-914/prism-quantized: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/jc-914/prism-quantized/resolve/main/example.py
- Command line
-
hf download hf://jc-914/prism-quantized/example.py
-
curl -L -o example.py https://huggingface.co/jc-914/prism-quantized/resolve/main/example.py
1.26 kB
| """Run one request through Sarvam-Prism INT4 (any CUDA GPU with ~10-16 GB, >= 64 GB host RAM). | |
| python example.py # from the Hugging Face Hub | |
| python example.py /path/to/local/copy # from a local copy | |
| python example.py . 12 # cap GPU memory use at 12 GiB | |
| """ | |
| import json, sys | |
| from prism_int4 import Prism | |
| model = Prism.from_pretrained(sys.argv[1] if len(sys.argv) > 1 else "jc-914/prism-quantized", | |
| gpu_memory_gb=float(sys.argv[2]) if len(sys.argv) > 2 else None) | |
| answers = model.decide( | |
| state={"ticket": "My card was charged twice for the same order and I still haven't got a refund."}, | |
| questions={ | |
| "team": {"type": "choice", "instructions": "Which team should handle this ticket?", | |
| "criteria": {"billing": "payments, charges and refunds", "tech": "app or website problems", | |
| "delivery": "shipping and order status"}}, | |
| "urgent": {"type": "yes_no", "instructions": "Does this need a reply within the hour?"}, | |
| "anger": {"type": "score", "instructions": "How upset is the customer?", | |
| "criteria": ["calm", "annoyed", "angry", "furious"]}, | |
| }) | |
| print(json.dumps(answers, indent=2)) | |