Text Classification
Transformers
Safetensors
English
nli
cross-encoder
qwen3.5
reranker
image-text-to-text
Instructions to use AlexWortega/openjev with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AlexWortega/openjev with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="AlexWortega/openjev")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AlexWortega/openjev", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download code/eval_fincalc.py from AlexWortega/openjev: direct link, hf CLI and curl.
- Browser
- Download file 2.36 kB
-
https://huggingface.co/AlexWortega/openjev/resolve/refs%2Fpr%2F4/code/eval_fincalc.py
- Command line
-
hf download hf://AlexWortega/openjev@refs/pr/4/code/eval_fincalc.py
-
curl -L -o eval_fincalc.py https://huggingface.co/AlexWortega/openjev/resolve/refs%2Fpr%2F4/code/eval_fincalc.py
2.36 kB
| #!/usr/bin/env python | |
| """Financial arithmetic for jev cross-encoders: FinCalc-NLI test split. Nothing here is trained on. | |
| python eval_fincalc.py --models ckpt/qwen3.5-4b-nli-v5 ckpt/qwen3.5-4b-nli --out results/fincalc_4b.json | |
| FinCalc-NLI (anespo28/fincalc-nli, MIT, synthetic): premise = evidence with the inputs and distractor figures | |
| (another company, the prior year, policy lines), hypothesis = a derived figure (LTV, DSCR, interest cover, net | |
| leverage, EBITDA margin, CET1, NPL ratio, NPL coverage, annual interest, net debt), a covenant pass/breach, or a | |
| plain lookup. Labels are computed in code. The test split uses names and templates disjoint from train, and one | |
| formula (NPL coverage) that train never shows. | |
| Reported: 3-way accuracy (argmax), per mistake kind (slip, inverted ratio, wrong entity, unit error, flipped | |
| covenant, missing input, ...) and per metric. | |
| """ | |
| import argparse | |
| import json | |
| from collections import defaultdict | |
| import numpy as np | |
| from eval import NLIScorer | |
| REPO = "anespo28/fincalc-nli" | |
| def load(n): | |
| from datasets import load_dataset | |
| ds = load_dataset(REPO, data_files={"test": "test.jsonl"}, split="test") | |
| return ds.shuffle(seed=0).select(range(min(n, len(ds)))) if n else ds | |
| def main(): | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--models", nargs="+", required=True) | |
| ap.add_argument("--out", required=True) | |
| ap.add_argument("--n", type=int, default=0, help="subsample the 4,000-item test split (0 = all)") | |
| ap.add_argument("--bs", type=int, default=32) | |
| a = ap.parse_args() | |
| ds = load(a.n) | |
| pairs = list(zip(ds["premise"], ds["hypothesis"])) | |
| gold = np.array(ds["label"]) # already in jev order: 0 contradiction, 1 entailment, 2 neutral | |
| res = {} | |
| for path in a.models: | |
| pred = NLIScorer(path, bs=a.bs).predict(pairs).argmax(1) | |
| by = defaultdict(list) | |
| for k, m, ok in zip(ds["kind"], ds["metric"], pred == gold): | |
| by["kind:" + k].append(ok) | |
| by["metric:" + m].append(ok) | |
| res[path] = {"n": len(pairs), "accuracy": round(float((pred == gold).mean()), 4), | |
| **{k: round(float(np.mean(v)), 4) for k, v in sorted(by.items())}} | |
| print(path, json.dumps(res[path]), flush=True) | |
| with open(a.out, "w") as f: | |
| json.dump(res, f, indent=2) | |
| if __name__ == "__main__": | |
| main() | |