修复多机训练问题 (#143)
* 修复多机训练问题 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -166,7 +166,8 @@ cython_debug/
|
|||||||
filelists/*
|
filelists/*
|
||||||
!/filelists/esd.list
|
!/filelists/esd.list
|
||||||
data/*
|
data/*
|
||||||
/config.yml
|
/*.yml
|
||||||
|
!/default_config.yml
|
||||||
/Web/
|
/Web/
|
||||||
/emotional/*/*.bin
|
/emotional/*/*.bin
|
||||||
/bert/*/*.bin
|
/bert/*/*.bin
|
||||||
@@ -176,5 +177,9 @@ data/*
|
|||||||
/bert/*/*.msgpack
|
/bert/*/*.msgpack
|
||||||
asr_transcript.py
|
asr_transcript.py
|
||||||
extract_list.py
|
extract_list.py
|
||||||
|
dataset
|
||||||
/Data
|
/Data
|
||||||
|
Model
|
||||||
|
raw/
|
||||||
|
logs/
|
||||||
Data/*
|
Data/*
|
||||||
|
|||||||
7
run_Mgpus.sh
Normal file
7
run_Mgpus.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
torchrun \
|
||||||
|
--nnodes=1:3\
|
||||||
|
--nproc_per_node=2\
|
||||||
|
--rdzv_id=1\
|
||||||
|
--rdzv_backend=c10d\
|
||||||
|
--rdzv_endpoint="ib1:8880"\
|
||||||
|
train_ms.py
|
||||||
@@ -62,6 +62,7 @@ def run():
|
|||||||
init_method="env://", # If Windows,switch to gloo backend.
|
init_method="env://", # If Windows,switch to gloo backend.
|
||||||
) # Use torchrun instead of mp.spawn
|
) # Use torchrun instead of mp.spawn
|
||||||
rank = dist.get_rank()
|
rank = dist.get_rank()
|
||||||
|
local_rank = int(os.environ["LOCAL_RANK"])
|
||||||
n_gpus = dist.get_world_size()
|
n_gpus = dist.get_world_size()
|
||||||
|
|
||||||
# 命令行/config.yml配置解析
|
# 命令行/config.yml配置解析
|
||||||
@@ -99,7 +100,8 @@ def run():
|
|||||||
f.write(data)
|
f.write(data)
|
||||||
|
|
||||||
torch.manual_seed(hps.train.seed)
|
torch.manual_seed(hps.train.seed)
|
||||||
torch.cuda.set_device(rank)
|
torch.cuda.set_device(local_rank)
|
||||||
|
|
||||||
global global_step
|
global global_step
|
||||||
if rank == 0:
|
if rank == 0:
|
||||||
logger = utils.get_logger(hps.model_dir)
|
logger = utils.get_logger(hps.model_dir)
|
||||||
|
|||||||
Reference in New Issue
Block a user