Instructions to use Meanblock/JEV-CPU with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Meanblock/JEV-CPU with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-classification", model="Meanblock/JEV-CPU")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Meanblock/JEV-CPU", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,420 Bytes
7845694 | 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 48 49 | import math
import pytest
from semif_phase1.core import direct_messages, softmax, validate_row
ROW = {
"id": "x",
"state": "owned evidence",
"question": "Which answer follows?",
"options": [
{"id": "yes", "description": "Yes."},
{"id": "no", "description": "No."},
],
}
def test_direct_prompt_excludes_extra_fields():
row = dict(ROW, label="yes", provenance={"secret": "do not leak"})
rendered = str(direct_messages(row))
assert "owned evidence" in rendered
assert "secret" not in rendered
assert "label" not in rendered
def test_softmax_is_finite_and_normalized():
values = softmax([1000.0, 999.0, -1000.0])
assert all(math.isfinite(value) for value in values)
assert sum(values) == pytest.approx(1.0)
assert values[0] > values[1] > values[2]
def test_duplicate_options_rejected():
row = dict(ROW, options=[ROW["options"][0], ROW["options"][0]])
with pytest.raises(ValueError, match="unique"):
validate_row(row)
def test_structured_json_state_is_supported():
row = dict(ROW, state={"policy": "Never request passwords", "candidate": ["invoice id"]})
validate_row(row)
assert '"policy"' in direct_messages(row)[1]["content"]
def test_nonfinite_structured_state_is_rejected():
with pytest.raises(ValueError, match="finite JSON-compatible"):
validate_row(dict(ROW, state={"score": float("nan")}))
|