Text Classification
PEFT
Safetensors
Portuguese
support-automation
e-commerce
portuguese
ticket-routing
decision-model
multi-task
lora
multi-specialist
Eval Results (legacy)
Instructions to use syvorai/veredicto with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use syvorai/veredicto with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Download scripts/paridade_multi.py from syvorai/veredicto: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/syvorai/veredicto/resolve/main/scripts/paridade_multi.py
- Command line
-
hf download hf://syvorai/veredicto/scripts/paridade_multi.py
-
curl -L -o paridade_multi.py https://huggingface.co/syvorai/veredicto/resolve/main/scripts/paridade_multi.py
1.78 kB
| import json, sys, urllib.request | |
| sys.path.insert(0, "/home/ubuntu/campanha_e/scripts") | |
| from avaliar_veredicto import chave_caso, split_por_caso | |
| K = int(sys.argv[1]) if len(sys.argv) > 1 else 25 | |
| ouro = [json.loads(l) for l in open("/home/ubuntu/campanha_e/data/processed/ouro_gold.jsonl")] | |
| _, teste = split_por_caso(ouro, 42) | |
| def load(p): | |
| d = {} | |
| for line in open(p): | |
| r = json.loads(line) | |
| d[(r["caso"], r["q"])] = r | |
| return d | |
| b2 = load("/home/ubuntu/campanha_b2/outputs/veredicto_b2/full_ouro/preds.jsonl") | |
| e1 = load("/home/ubuntu/campanha_e/outputs/veredicto_e1/full_ouro/preds.jsonl") | |
| v4 = load("/home/ubuntu/campanha_e/data/gold_preds_v4.jsonl") | |
| fonte = {"categoria": b2, "decisao": e1, "urgencia": v4} | |
| estados = {} | |
| for row in ouro: | |
| ck = chave_caso(row["estado"]) | |
| if ck in teste: | |
| estados[ck] = row["estado"] | |
| ok = {"categoria": 0, "decisao": 0, "urgencia": 0} | |
| tot = lat = 0 | |
| for ck in sorted(estados)[:K]: | |
| req = urllib.request.Request( | |
| "http://localhost:8200/decidir", | |
| data=json.dumps({"estado": estados[ck], "limiar": 0.8}).encode(), | |
| headers={"Content-Type": "application/json"}) | |
| resp = json.loads(urllib.request.urlopen(req, timeout=120).read()) | |
| lat += resp["latencia_ms"] | |
| tot += 1 | |
| for q in ("categoria", "decisao", "urgencia"): | |
| esperado = fonte[q][(ck, q)]["option_ids"][fonte[q][(ck, q)]["pred"]] | |
| got = resp["respostas"][q]["resposta"] | |
| if got == esperado: | |
| ok[q] += 1 | |
| else: | |
| print(f" MISMATCH {ck[:8]} {q}: api={got} esperado={esperado}") | |
| print(f"\n{tot} casos | latência média {lat//max(tot,1)} ms/caso (3 forwards)") | |
| for q in ("categoria", "decisao", "urgencia"): | |
| print(f" {q}: {ok[q]}/{tot} concordam com o teste de mesa") | |