-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathTasNET_train.py
42 lines (34 loc) · 1.45 KB
/
TasNET_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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import pdb
import argparse
import time
from TasNET_model import TasNET
from trainer import TasNET_trainer
from dataset import TasDataset
from torch.utils.data import DataLoader
from utils import parse_yaml
def train(args):
config_dict = parse_yaml(args.config)
loader_config = config_dict["dataloader"]
train_config = config_dict["trainer"]
temp = config_dict["temp"]
train_dataset = TasDataset(loader_config["train_path_npz"])
valid_dataset = TasDataset(loader_config["valid_path_npz"])
train_loader = DataLoader(train_dataset, batch_size=loader_config["batch_size"], shuffle=True,
num_workers=4, drop_last=True, pin_memory=True)
valid_loader = DataLoader(valid_dataset, batch_size=loader_config["batch_size"], shuffle=True,
num_workers=4, drop_last=True, pin_memory=True)
tasnet = TasNET()
trainer = TasNET_trainer(tasnet, **train_config)
trainer.run(train_loader, valid_loader)
#trainer.rerun(train_loader, valid_loader, temp["model_path"], temp["epoch_done"])
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="Speech Enhancement Neural Network by PyTorch ")
parser.add_argument(
"--config",
type=str,
default="train.yaml",
dest="config",
help="Location of .yaml configure files for training")
args = parser.parse_args()
train(args)