jeb-onnx

ONNX export of IJyad/jeb — the Arabic typed decision model. Runs anywhere ONNX Runtime runs: CPU, no PyTorch, no Python required for inference.

Parity: verified. Maximum absolute probability difference against the PyTorch model is 2.38e-07 on identical input — the same answer with the same confidence.

Usage

import numpy as np, onnxruntime as ort
from transformers import AutoTokenizer

tok  = AutoTokenizer.from_pretrained('IJyad/jeb-onnx', subfolder='tokenizer')
sess = ort.InferenceSession('model.onnx', providers=['CPUExecutionProvider'])

state = "أعلنت الشركة عن أرباح قياسية في الربع الثالث من هذا العام"
instructions = "ما هو موضوع هذا المقال؟"
criteria = {"Tech": "تقنية", "Finance": "اقتصاد ومال", "Politics": "سياسة",
            "Religion": "دين", "Medical": "طب وصحة", "Culture": "ثقافة", "Sports": "رياضة"}

opts  = list(criteria)
parts = [tok.cls_token, state, tok.sep_token, instructions]
for o in opts:
    parts += [tok.mask_token, f"{o}: {criteria[o]}"]
enc = tok([" ".join(parts)], return_tensors="np", truncation=True, max_length=256)

scores = sess.run(None, {"input_ids": enc["input_ids"].astype(np.int64),
                         "attention_mask": enc["attention_mask"].astype(np.int64)})[0]
pos = np.where(enc["input_ids"][0] == tok.mask_token_id)[0][:len(opts)]
sel = scores[0][pos]
p = np.exp(sel - sel.max()); p /= p.sum()

n, peak = len(opts), float(p.max())
confidence = max(0.0, min(1.0, (n * peak - 1) / (n - 1)))
print(opts[int(p.argmax())], round(confidence, 3))   # Finance 0.978

The model emits a score for every token; gather the [MASK] positions for your options and softmax across them. The answer space is defined at request time — no retraining for new schemas.

Files

file
model.onnx graph (opset 17)
model.onnx.data weights, 708 MB — both files required
tokenizer/ MARBERTv2 tokenizer

Benchmarks, training detail and honest limits: IJyad/jeb.

Apache 2.0

Downloads last month
9
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for IJyad/jeb-onnx

Base model

IJyad/jeb
Quantized
(1)
this model