Download tests/test_config.py from HWresearch/GNN4Colliders: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/HWresearch/GNN4Colliders/resolve/main/tests/test_config.py
- Command line
-
hf download hf://HWresearch/GNN4Colliders/tests/test_config.py
-
curl -L -o test_config.py https://huggingface.co/HWresearch/GNN4Colliders/resolve/main/tests/test_config.py
1.46 kB
| from pathlib import Path | |
| import pytest | |
| from gnn4colliders.config import load_config, save_config | |
| CONFIGS = sorted((Path(__file__).resolve().parents[1] / "configs").glob("*.yaml")) | |
| def test_every_shipped_config_loads_and_round_trips(path, tmp_path): | |
| config = load_config(path) | |
| assert config.run_dir == f"outputs/{config.name}" | |
| saved = save_config(config, tmp_path / "config.yaml") | |
| assert load_config(saved) == config | |
| def test_overrides_parse_yaml_values_and_fast_expands(): | |
| path = CONFIGS[0].parent / "gamgam.yaml" | |
| config = load_config( | |
| path, | |
| [ | |
| "train.fast=true", | |
| "train.learning_rate=1e-3", | |
| "data.files=[{path: a, label: 1}]", | |
| ], | |
| ) | |
| train = config.train | |
| assert train.compile and train.cuda_graphs and train.allow_tf32 | |
| assert train.precision == "bfloat16" and train.learning_rate == 1e-3 | |
| assert config.data.files == [{"path": "a", "label": 1}] | |
| def test_invalid_configs_are_rejected(override, message): | |
| with pytest.raises(ValueError, match=message): | |
| load_config(CONFIGS[0].parent / "gamgam.yaml", [override]) | |