QEV1.1-9B / example.py
querypieai's picture
Release self-contained QEV multitask model
0127113 verified
Raw History Blame Contribute Delete
1.12 kB
"""Run the self-contained local folder; optional repo ID after publication."""
import argparse
import json
from pathlib import Path
from transformers import AutoModel
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--model', default=str(Path(__file__).resolve().parent))
parser.add_argument('--device', default='cuda:0')
args = parser.parse_args()
model = AutoModel.from_pretrained(args.model, trust_remote_code=True, device=args.device)
result = model.decide('The ticket category is security. Routing rule: security goes to Sentinel.', {
'route': {'type': 'choice', 'instructions': 'Choose the required tool.',
'criteria': {'ledger': 'Ledger', 'sentinel': 'Sentinel'}},
'security': {'type': 'noul', 'instructions': 'Is this a security ticket?',
'criteria': {'false': 'No', 'true': 'Yes'}},
'grade': {'type': 'score', 'instructions': 'Security tickets have high priority.',
'criteria': ['Low', 'Medium', 'High']}
})
print(json.dumps(result, ensure_ascii=False, indent=2))