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
Download tests/test_release.py from kitaniai/OpenJudgement-4B-Preview: direct link, hf CLI and curl.
- Browser
- Download file 1.8 kB
-
https://huggingface.co/kitaniai/OpenJudgement-4B-Preview/resolve/main/tests/test_release.py
- Command line
-
hf download hf://kitaniai/OpenJudgement-4B-Preview/tests/test_release.py
-
curl -L -o test_release.py https://huggingface.co/kitaniai/OpenJudgement-4B-Preview/resolve/main/tests/test_release.py
1.8 kB
| import json | |
| from pathlib import Path | |
| import pytest | |
| from transformers import AutoTokenizer | |
| from v4_prompt import messages_for | |
| from core import normalize_question,text | |
| from openjudgement import OpenJudgement | |
| ROOT=Path(__file__).resolve().parents[1] | |
| def test_real_tokenizer_and_examples(): | |
| tokenizer=AutoTokenizer.from_pretrained(ROOT,local_files_only=True) | |
| assert all(len(tokenizer.encode(str(i),add_special_tokens=False))==1 for i in range(10)) | |
| assert len(tokenizer.encode('10',add_special_tokens=False))>1 | |
| req=json.loads((ROOT/'examples/request.json').read_text()) | |
| for q in req['questions'].values(): | |
| kind,instruction,options,keys=normalize_question(q) | |
| row={'state':text(req['state']),'kind':kind,'instructions':instruction,'candidates':options,'keys':keys} | |
| tokens=tokenizer.apply_chat_template(messages_for(row),tokenize=True,add_generation_prompt=True,enable_thinking=False,return_dict=False) | |
| assert isinstance(tokens,list) and 0<len(tokens)<32768 | |
| def test_loader_local_metadata_without_weights(tmp_path,monkeypatch): | |
| (tmp_path/'config.json').write_text('{}') | |
| (tmp_path/'openjudgment_config.json').write_text(json.dumps({'model_id':'kitaniai/OpenJudgement-4B-Preview'})) | |
| called={} | |
| def fake_init(self,path,**kwargs): called.update(path=path,**kwargs) | |
| monkeypatch.setattr(OpenJudgement,'__init__',fake_init) | |
| monkeypatch.setattr(OpenJudgement,'eval',lambda self:self) | |
| judge=OpenJudgement.from_pretrained(str(tmp_path),device='cpu') | |
| assert judge.model_name=='kitaniai/OpenJudgement-4B-Preview' | |
| assert called['device']=='cpu' | |
| def test_loader_rejects_incomplete_local_folder(tmp_path): | |
| with pytest.raises(ValueError,match='config.json'): | |
| OpenJudgement.from_pretrained(str(tmp_path),device='cpu') | |