-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtrain.py
28 lines (18 loc) · 873 Bytes
/
train.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import hydra
from omegaconf import DictConfig
from complex_neural_source_localization.datasets import create_dataloaders
from complex_neural_source_localization.trainer import DOACNetTrainer
@hydra.main(config_path="config", config_name="config", version_base=None)
def train(config: DictConfig):
"""Runs the training procedure using Pytorch lightning
And tests the model with the best validation score against the test dataset.
Args:
config (DictConfig): Configuration automatically loaded by Hydra.
See the config/ directory for the configuration
"""
dataset_train, dataset_val, dataset_test = create_dataloaders(config)
trainer = DOACNetTrainer(config)
trainer.fit(dataset_train, val_dataloaders=dataset_val)
trainer.test(dataset_test)
if __name__ == "__main__":
train()