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
File size: 1,783 Bytes
8249eac | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 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")
|