fix
This commit is contained in:
33
tests/test_configure_matcha_ft.py
Normal file
33
tests/test_configure_matcha_ft.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from configure_matcha_ft import configure_matcha_ft
|
||||
|
||||
|
||||
def test_configure_matcha_ft_and_joint_mode(tmp_path: Path) -> None:
|
||||
config_path = tmp_path / "config.json"
|
||||
config_path.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"train": {"learning_rate": 0.0002, "epochs": 100},
|
||||
"model": {"use_matcha": False},
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
configured = configure_matcha_ft(
|
||||
config_path,
|
||||
learning_rate=0.0001,
|
||||
epochs=20,
|
||||
save_every_steps=50,
|
||||
)
|
||||
assert configured["train"]["matcha_only"] is True
|
||||
assert configured["train"]["learning_rate"] == 0.0001
|
||||
assert configured["train"]["eval_interval"] == 50
|
||||
assert configured["model"]["use_matcha"] is True
|
||||
assert configured["model"]["matcha_use_diff_attention"] is True
|
||||
assert config_path.with_suffix(".json.bak").is_file()
|
||||
|
||||
configured = configure_matcha_ft(config_path, matcha_only=False)
|
||||
assert configured["train"]["matcha_only"] is False
|
||||
Reference in New Issue
Block a user