Text Classification
Transformers
Safetensors
English
Ukrainian
qwen3_5
image-text-to-text
openjudgement
judgment
classification
structured-output
preview
custom-code
Instructions to use kitaniai/OpenJudgement-4B-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kitaniai/OpenJudgement-4B-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="kitaniai/OpenJudgement-4B-Preview")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("kitaniai/OpenJudgement-4B-Preview") model = AutoModelForMultimodalLM.from_pretrained("kitaniai/OpenJudgement-4B-Preview", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,715 Bytes
eb2384f | 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 | from fastapi.testclient import TestClient
from serve import create_app
class FakeJudge:
model_name = 'test-preview'
def system_one(self, state, questions):
if state == 'invalid':
raise ValueError('Input exceeds configured context; nothing was truncated.')
return {'model': self.model_name, 'answers': {key: {'type': 'noul', 'noul': 0.75} for key in questions}}
def test_api_request_and_health():
with TestClient(create_app(loader=FakeJudge)) as client:
assert client.get('/health').json()['ready'] is True
response = client.post('/v1/judgments', json={'state': 'Evidence.', 'questions': {'q': {'type': 'noul', 'instructions': 'Supported?'}}})
assert response.status_code == 200
assert response.json()['answers']['q']['noul'] == 0.75
assert response.json()['timing']['inference_ms'] >= 0
def test_api_rejects_bad_requests_without_inference():
with TestClient(create_app(loader=FakeJudge)) as client:
assert client.post('/v1/judgments', json={'state': 'Evidence.', 'questions': {}}).status_code == 422
assert client.post('/v1/judgments', json={'state': 'invalid', 'questions': {'q': {}}}).status_code == 422
def test_examples_follow_native_contract():
import json
from pathlib import Path
from core import normalize_question
request = json.loads((Path(__file__).resolve().parents[1]/'examples/request.json').read_text())
assert {q['type'] for q in request['questions'].values()} == {'noul','choice','score'}
for question in request['questions'].values():
kind,instructions,candidates,keys = normalize_question(question)
assert instructions and len(candidates) == len(keys)
|