Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions egs/wsj/s5/steps/libs/nnet3/train/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,9 +941,10 @@ def __init__(self,
action=common_lib.NullstrToNoneAction,
help="Script to launch egs jobs")
self.parser.add_argument("--use-gpu", type=str,
action=common_lib.StrToBoolAction,
choices=["true", "false"],
help="Use GPU for training", default=True)
choices=["true", "false", "yes", "no", "wait"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably mention that "true" and "false" are deprecated.

help="Use GPU for training. "
"Note 'true' and 'false' are deprecated.",
default="yes")
self.parser.add_argument("--cleanup", type=str,
action=common_lib.StrToBoolAction,
choices=["true", "false"], default=True,
Expand Down
9 changes: 5 additions & 4 deletions egs/wsj/s5/steps/nnet3/chain/e2e/train_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ def process_args(args):

# set the options corresponding to args.use_gpu
run_opts = common_train_lib.RunOpts()
if args.use_gpu:
if args.use_gpu in ["true", "false"]:
args.use_gpu = ("yes" if args.use_gpu == "true" else "no")
if args.use_gpu in ["yes", "wait"]:
if not common_lib.check_if_cuda_compiled():
logger.warning(
"""You are running with one thread but you have not compiled
Expand All @@ -219,10 +221,9 @@ def process_args(args):
./configure; make""")

run_opts.train_queue_opt = "--gpu 1"
run_opts.parallel_train_opts = ""
run_opts.parallel_train_opts = "--use-gpu={}".format(args.use_gpu)
run_opts.combine_queue_opt = "--gpu 1"
run_opts.combine_gpu_opt = ""

run_opts.combine_gpu_opt = "--use-gpu={}".format(args.use_gpu)

else:
logger.warning("Without using a GPU this will be very slow. "
Expand Down
8 changes: 5 additions & 3 deletions egs/wsj/s5/steps/nnet3/chain/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ def process_args(args):
args.transform_dir = args.lat_dir
# set the options corresponding to args.use_gpu
run_opts = common_train_lib.RunOpts()
if args.use_gpu:
if args.use_gpu in ["true", "false"]:
args.use_gpu = ("yes" if args.use_gpu == "true" else "no")
if args.use_gpu in ["yes", "wait"]:
if not common_lib.check_if_cuda_compiled():
logger.warning(
"""You are running with one thread but you have not compiled
Expand All @@ -237,9 +239,9 @@ def process_args(args):
./configure; make""")

run_opts.train_queue_opt = "--gpu 1"
run_opts.parallel_train_opts = ""
run_opts.parallel_train_opts = "--use-gpu={}".format(args.use_gpu)
run_opts.combine_queue_opt = "--gpu 1"
run_opts.combine_gpu_opt = ""
run_opts.combine_gpu_opt = "--use-gpu={}".format(args.use_gpu)

else:
logger.warning("Without using a GPU this will be very slow. "
Expand Down
11 changes: 7 additions & 4 deletions egs/wsj/s5/steps/nnet3/train_dnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def process_args(args):

# set the options corresponding to args.use_gpu
run_opts = common_train_lib.RunOpts()
if args.use_gpu:
if args.use_gpu in ["true", "false"]:
args.use_gpu = ("yes" if args.use_gpu == "true" else "no")
if args.use_gpu in ["yes", "wait"]:
if not common_lib.check_if_cuda_compiled():
logger.warning(
"""You are running with one thread but you have not compiled
Expand All @@ -127,11 +129,12 @@ def process_args(args):
./configure; make""")

run_opts.train_queue_opt = "--gpu 1"
run_opts.parallel_train_opts = ""
run_opts.combine_gpu_opt = ""
run_opts.parallel_train_opts = "--use-gpu={}".format(args.use_gpu)
run_opts.combine_gpu_opt = "--use-gpu={}".format(args.use_gpu)
run_opts.combine_queue_opt = "--gpu 1"
run_opts.prior_gpu_opt = "--use-gpu=yes"
run_opts.prior_gpu_opt = "--use-gpu={}".format(args.use_gpu)
run_opts.prior_queue_opt = "--gpu 1"

else:
logger.warning("Without using a GPU this will be very slow. "
"nnet3 does not yet support multiple threads.")
Expand Down
10 changes: 6 additions & 4 deletions egs/wsj/s5/steps/nnet3/train_raw_dnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def process_args(args):

# set the options corresponding to args.use_gpu
run_opts = common_train_lib.RunOpts()
if args.use_gpu:
if args.use_gpu in ["true", "false"]:
args.use_gpu = ("yes" if args.use_gpu == "true" else "no")
if args.use_gpu in ["yes", "wait"]:
if not common_lib.check_if_cuda_compiled():
logger.warning(
"""You are running with one thread but you have not compiled
Expand All @@ -135,10 +137,10 @@ def process_args(args):
./configure; make""")

run_opts.train_queue_opt = "--gpu 1"
run_opts.parallel_train_opts = ""
run_opts.combine_gpu_opt = ""
run_opts.parallel_train_opts = "--use-gpu={}".format(args.use_gpu)
run_opts.combine_gpu_opt = "--use-gpu={}".format(args.use_gpu)
run_opts.combine_queue_opt = "--gpu 1"
run_opts.prior_gpu_opt = "--use-gpu=yes"
run_opts.prior_gpu_opt = "--use-gpu={}".format(args.use_gpu)
run_opts.prior_queue_opt = "--gpu 1"

else:
Expand Down
10 changes: 6 additions & 4 deletions egs/wsj/s5/steps/nnet3/train_raw_rnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ def process_args(args):

# set the options corresponding to args.use_gpu
run_opts = common_train_lib.RunOpts()
if args.use_gpu:
if args.use_gpu in ["true", "false"]:
args.use_gpu = ("yes" if args.use_gpu == "true" else "no")
if args.use_gpu in ["yes", "wait"]:
if not common_lib.check_if_cuda_compiled():
logger.warning(
"""You are running with one thread but you have not compiled
Expand All @@ -188,10 +190,10 @@ def process_args(args):
./configure; make""")

run_opts.train_queue_opt = "--gpu 1"
run_opts.parallel_train_opts = ""
run_opts.combine_gpu_opt = ""
run_opts.parallel_train_opts = "--use-gpu={}".format(args.use_gpu)
run_opts.combine_gpu_opt = "--use-gpu={}".format(args.use_gpu)
run_opts.combine_queue_opt = "--gpu 1"
run_opts.prior_gpu_opt = "--use-gpu=yes"
run_opts.prior_gpu_opt = "--use-gpu={}".format(args.use_gpu)
run_opts.prior_queue_opt = "--gpu 1"

else:
Expand Down
10 changes: 6 additions & 4 deletions egs/wsj/s5/steps/nnet3/train_rnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ def process_args(args):

# set the options corresponding to args.use_gpu
run_opts = common_train_lib.RunOpts()
if args.use_gpu:
if args.use_gpu in ["true", "false"]:
args.use_gpu = ("yes" if args.use_gpu == "true" else "no")
if args.use_gpu in ["yes", "wait"]:
if not common_lib.check_if_cuda_compiled():
logger.warning(
"""You are running with one thread but you have not compiled
Expand All @@ -182,10 +184,10 @@ def process_args(args):
./configure; make""")

run_opts.train_queue_opt = "--gpu 1"
run_opts.parallel_train_opts = ""
run_opts.combine_gpu_opt = ""
run_opts.parallel_train_opts = "--use-gpu={}".format(args.use_gpu)
run_opts.combine_gpu_opt = "--use-gpu={}".format(args.use_gpu)
run_opts.combine_queue_opt = "--gpu 1"
run_opts.prior_gpu_opt = "--use-gpu=yes"
run_opts.prior_gpu_opt = "--use-gpu={}".format(args.use_gpu)
run_opts.prior_queue_opt = "--gpu 1"

else:
Expand Down