Files
K3/tests/integration/test_eval_files.py
T
dela 584f7e9e73 Initial K3 snapshot: 0.5B KDA/MLA/MoE train path
Standalone tree split from LLMRL/projects/kda. Includes Triton dt_bias
backward fix, train_k3 --preset 0.5b, SFT, Docker runtime, and tests.
2026-08-25 14:43:17 +08:00

24 lines
843 B
Python

from pathlib import Path
from kda.training.eval_mt import _instruction
from kda.training.prompts import instruction_prompt
_ROOT = Path(__file__).resolve().parents[2] / "data" / "eval"
def _lines(name: str) -> list[str]:
return [ln.strip() for ln in (_ROOT / name).read_text(encoding="utf-8").splitlines() if ln.strip()]
def test_frozen_eval_files_are_aligned():
zh_src, zh_ref = _lines("zh2en.src.txt"), _lines("zh2en.ref.txt")
en_src, en_ref = _lines("en2zh.src.txt"), _lines("en2zh.ref.txt")
assert len(zh_src) == len(zh_ref) >= 16
assert len(en_src) == len(en_ref) >= 16
assert all("\t" not in s for s in zh_src + en_src)
def test_eval_instruction_is_the_sft_template():
assert _instruction("q", "en") == instruction_prompt("q", "en")
assert _instruction("q", "zh") == instruction_prompt("q", "zh")