forked from openvpi/DiffSinger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain.py
More file actions
31 lines (21 loc) · 750 Bytes
/
train.py
File metadata and controls
31 lines (21 loc) · 750 Bytes
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
import importlib
import os
import sys
from pathlib import Path
root_dir = Path(__file__).parent.parent.resolve()
os.environ['PYTHONPATH'] = str(root_dir)
sys.path.insert(0, str(root_dir))
os.environ['TORCH_CUDNN_V8_API_ENABLED'] = '1' # Prevent unacceptable slowdowns when using 16 precision
from utils.hparams import set_hparams, hparams
set_hparams()
if not hparams['nccl_p2p']:
print("Disabling NCCL P2P")
os.environ['NCCL_P2P_DISABLE'] = '1'
def run_task():
assert hparams['task_cls'] != ''
pkg = ".".join(hparams["task_cls"].split(".")[:-1])
cls_name = hparams["task_cls"].split(".")[-1]
task_cls = getattr(importlib.import_module(pkg), cls_name)
task_cls.start()
if __name__ == '__main__':
run_task()