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.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
"""translation_success and eval helpers (no GPU, no FLORES download)."""
|
||||
from kda.training.success import translation_success
|
||||
|
||||
|
||||
def test_empty_and_copy_fail():
|
||||
src = "人工智能的发展改变了世界。"
|
||||
assert translation_success(src, "", ref="The development of AI changed the world.", target_lang="en") is False
|
||||
assert translation_success(src, src, ref="The development of AI changed the world.", target_lang="en") is False
|
||||
|
||||
|
||||
def test_wrong_language_fails():
|
||||
src = "The cat sat on the mat."
|
||||
hyp = "The cat sat on the mat and smiled."
|
||||
ref = "猫坐在垫子上。"
|
||||
assert translation_success(src, hyp, ref, target_lang="zh") is False
|
||||
|
||||
|
||||
def test_instruction_leak_fails():
|
||||
src = "Hello"
|
||||
hyp = "翻译如下:你好"
|
||||
assert translation_success(src, hyp, ref="你好", target_lang="zh") is False
|
||||
|
||||
|
||||
def test_good_zh2en_passes():
|
||||
src = "今天天气很好。"
|
||||
hyp = "The weather is very nice today."
|
||||
ref = "The weather is very nice today."
|
||||
assert translation_success(src, hyp, ref, target_lang="en") is True
|
||||
|
||||
|
||||
def test_container_help_exits_2():
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
path = Path(__file__).resolve().parents[2] / "scripts" / "container_help.py"
|
||||
spec = importlib.util.spec_from_file_location("container_help", path)
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
assert spec.loader is not None
|
||||
spec.loader.exec_module(mod)
|
||||
with pytest.raises(SystemExit) as ei:
|
||||
mod.main()
|
||||
assert ei.value.code == 2
|
||||
Reference in New Issue
Block a user