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/serving/prompt_templates.py from AlexWortega/openjev: direct link, hf CLI and curl.
- Browser
- Download file 2.38 kB
-
https://huggingface.co/AlexWortega/openjev/resolve/main/code/serving/prompt_templates.py
- Command line
-
hf download hf://AlexWortega/openjev/code/serving/prompt_templates.py
-
curl -L -o prompt_templates.py https://huggingface.co/AlexWortega/openjev/resolve/main/code/serving/prompt_templates.py
2.38 kB
| """Generic, explicit prompt alternatives. The production default stays trained.""" | |
| from dataclasses import dataclass | |
| import numpy as np | |
| from decisions_api import Plan, _options, _text, assemble, build_plan | |
| STYLES = ("trained", "unquoted", "direct_noul") | |
| class PromptPlan: | |
| base: Plan | |
| pairs: list | |
| # Each base score either comes from one model score or a boolean complement. | |
| ordinary: list | |
| direct: list | |
| def build_prompt_plan(body, style="trained"): | |
| if style not in STYLES: | |
| raise ValueError(f"Unknown prompt style: {style}") | |
| base = build_plan(body) | |
| pairs, ordinary, direct = [], [], [] | |
| for q in base.questions: | |
| source = body["questions"][q.qid] | |
| instr = _text(source.get("instructions", "")).strip() | |
| _, labels, crits = _options(q.qid, source) | |
| n = len(labels) | |
| if style == "direct_noul" and q.qtype == "noul" and source.get("criteria") is None: | |
| positions = [] | |
| for w in range(q.n_windows): | |
| positions.append(len(pairs)) | |
| pairs.append((base.pairs[q.start + w * n][0], instr)) | |
| direct.append((q, positions)) | |
| continue | |
| for w in range(q.n_windows): | |
| for j in range(n): | |
| index = q.start + w*n + j | |
| premise, hypothesis = base.pairs[index] | |
| if style == "unquoted": | |
| hypothesis = f"Question: {instr}\nAnswer: {labels[j]}: {crits[j]}" | |
| ordinary.append((index, len(pairs))) | |
| pairs.append((premise, hypothesis)) | |
| return PromptPlan(base, pairs, ordinary, direct) | |
| def finish_answers(plan, entailment): | |
| e = np.asarray(entailment, dtype=float) | |
| if e.shape != (len(plan.pairs),) or not np.isfinite(e).all() or ((e < 0) | (e > 1)).any(): | |
| raise ValueError("Invalid entailment scores") | |
| expanded = np.empty(len(plan.base.pairs), dtype=float) | |
| for old, new in plan.ordinary: | |
| expanded[old] = e[new] | |
| for q, positions in plan.direct: | |
| # A bare assertion is true to the degree it is entailed. Neutral mass | |
| # stays outside P(true); no gold-derived temperature or calibration. | |
| true = float(e[positions].max()) | |
| for w in range(q.n_windows): | |
| expanded[q.start + 2*w:q.start + 2*w + 2] = [1-true, true] | |
| return assemble(plan.base, expanded) | |