checkpoint
This commit is contained in:
commit
d0deefd8cf
35 changed files with 2543 additions and 0 deletions
38
tests/test_train_config.py
Normal file
38
tests/test_train_config.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import runpy
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from omegaconf.errors import ConfigKeyError
|
||||
|
||||
SCRIPT_PATH = Path(__file__).parents[1] / "scripts" / "train.py"
|
||||
|
||||
|
||||
def load_config(args):
|
||||
script = runpy.run_path(str(SCRIPT_PATH), run_name="train_script")
|
||||
return script["load_config"](args)
|
||||
|
||||
|
||||
def test_cli_values_override_structured_defaults():
|
||||
config = load_config(
|
||||
[
|
||||
"num_envs=32",
|
||||
"lr=1e-4",
|
||||
"grid_dims=[6,6]",
|
||||
"checkpoint_path=models/test.eqx",
|
||||
"opponent=hunter",
|
||||
"resume_from=models/previous.eqx",
|
||||
]
|
||||
)
|
||||
|
||||
assert config.num_envs == 32
|
||||
assert config.lr == 1e-4
|
||||
assert list(config.grid_dims) == [6, 6]
|
||||
assert config.checkpoint_path == "models/test.eqx"
|
||||
assert config.opponent == "hunter"
|
||||
assert config.resume_from == "models/previous.eqx"
|
||||
assert config.rollout_steps == 256
|
||||
|
||||
|
||||
def test_unknown_cli_key_is_rejected():
|
||||
with pytest.raises(ConfigKeyError):
|
||||
load_config(["unknown_option=1"])
|
||||
Loading…
Reference in a new issue