def process_args(args): """ Process the options got from get_args() """ if not common_train_lib.validate_chunk_width(args.chunk_width): raise Exception("--egs.chunk-width has an invalid value") if not common_train_lib.validate_minibatch_size_str(args.num_chunk_per_minibatch): raise Exception("--trainer.num-chunk-per-minibatch has an invalid value") if args.chunk_left_context < 0: raise Exception("--egs.chunk-left-context should be non-negative") if args.chunk_right_context < 0: raise Exception("--egs.chunk-right-context should be non-negative") if args.left_deriv_truncate is not None: args.deriv_truncate_margin = -args.left_deriv_truncate logger.warning( "--chain.left-deriv-truncate (deprecated) is set by user, and " "--trainer.deriv-truncate-margin is set to negative of that " "value={0}. We recommend using the option " "--trainer.deriv-truncate-margin.".format(args.deriv_truncate_margin) ) if not os.path.exists(args.dir) or not os.path.exists(args.dir + "/configs"): raise Exception( "This scripts expects {0} to exist and have a configs " "directory which is the output of " "make_configs.py script" ) if args.transform_dir is None: 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 not common_lib.check_if_cuda_compiled(): logger.warning( """You are running with one thread but you have not compiled for CUDA. You may be running a setup optimized for GPUs. If you have GPUs and have nvcc installed, go to src/ and do ./configure; make""" ) run_opts.train_queue_opt = "--gpu 1" run_opts.parallel_train_opts = "" run_opts.combine_queue_opt = "--gpu 1" else: logger.warning("Without using a GPU this will be very slow. " "nnet3 does not yet support multiple threads.") run_opts.train_queue_opt = "" run_opts.parallel_train_opts = "--use-gpu=no" run_opts.combine_queue_opt = "" run_opts.command = args.command run_opts.egs_command = args.egs_command if args.egs_command is not None else args.command return [args, run_opts]
def process_args(args): """ Process the options got from get_args() """ if not common_train_lib.validate_chunk_width(args.chunk_width): raise Exception("--egs.chunk-width has an invalid value") if not common_train_lib.validate_minibatch_size_str( args.num_chunk_per_minibatch): raise Exception( "--trainer.rnn.num-chunk-per-minibatch has an invalid value") if args.chunk_left_context < 0: raise Exception("--egs.chunk-left-context should be non-negative") if args.chunk_right_context < 0: raise Exception("--egs.chunk-right-context should be non-negative") if (not os.path.exists(args.dir) or not os.path.exists(args.dir + "/configs")): raise Exception("This scripts expects {0} to exist and have a configs " "directory which is the output of " "make_configs.py script") # set the options corresponding to args.use_gpu run_opts = common_train_lib.RunOpts() 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 for CUDA. You may be running a setup optimized for GPUs. If you have GPUs and have nvcc installed, go to src/ and do ./configure; make""") run_opts.train_queue_opt = "--gpu 1" 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={}".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.") run_opts.train_queue_opt = "" run_opts.parallel_train_opts = "--use-gpu=no" run_opts.combine_gpu_opt = "--use-gpu=no" run_opts.combine_queue_opt = "" run_opts.prior_gpu_opt = "--use-gpu=no" run_opts.prior_queue_opt = "" run_opts.command = args.command run_opts.egs_command = (args.egs_command if args.egs_command is not None else args.command) run_opts.num_jobs_compute_prior = args.num_jobs_compute_prior return [args, run_opts]
def process_args(args): """ Process the options got from get_args() """ if not common_train_lib.validate_chunk_width(args.chunk_width): raise Exception("--egs.chunk-width has an invalid value") if not common_train_lib.validate_minibatch_size_str(args.num_chunk_per_minibatch): raise Exception("--trainer.rnn.num-chunk-per-minibatch has an invalid value") if args.chunk_left_context < 0: raise Exception("--egs.chunk-left-context should be non-negative") if args.chunk_right_context < 0: raise Exception("--egs.chunk-right-context should be non-negative") if (not os.path.exists(args.dir) or not os.path.exists(args.dir+"/configs")): raise Exception("This scripts expects {0} to exist and have a configs " "directory which is the output of " "make_configs.py script") # set the options corresponding to args.use_gpu run_opts = common_train_lib.RunOpts() 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 for CUDA. You may be running a setup optimized for GPUs. If you have GPUs and have nvcc installed, go to src/ and do ./configure; make""") run_opts.train_queue_opt = "--gpu 1" 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={}".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.") run_opts.train_queue_opt = "" run_opts.parallel_train_opts = "--use-gpu=no" run_opts.combine_gpu_opt = "--use-gpu=no" run_opts.combine_queue_opt = "" run_opts.prior_gpu_opt = "--use-gpu=no" run_opts.prior_queue_opt = "" run_opts.command = args.command run_opts.egs_command = (args.egs_command if args.egs_command is not None else args.command) run_opts.num_jobs_compute_prior = args.num_jobs_compute_prior return [args, run_opts]
def process_args(args): """ Process the options got from get_args() """ if args.frames_per_eg < 1: raise Exception("--egs.frames-per-eg should have a minimum value of 1") if not common_train_lib.validate_minibatch_size_str(args.minibatch_size): raise Exception( "--trainer.optimization.minibatch-size has an invalid value") if (not os.path.exists(args.dir)): raise Exception("Directory specified with --dir={0} " "does not exist.".format(args.dir)) if (not os.path.exists(args.dir + "/configs") and (args.input_model is None or not os.path.exists(args.input_model))): raise Exception( "Either --trainer.input-model option should be supplied, " "and exist; or the {0}/configs directory should exist." "{0}/configs is the output of make_configs.py" "".format(args.dir)) # set the options corresponding to args.use_gpu run_opts = common_train_lib.RunOpts() 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 for CUDA. You may be running a setup optimized for GPUs. If you have GPUs and have nvcc installed, go to src/ and do ./configure; make""") run_opts.train_queue_opt = "--gpu 1" 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={}".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.") run_opts.train_queue_opt = "" run_opts.parallel_train_opts = "--use-gpu=no" run_opts.combine_gpu_opt = "--use-gpu=no" run_opts.combine_queue_opt = "" run_opts.prior_gpu_opt = "--use-gpu=no" run_opts.prior_queue_opt = "" run_opts.command = args.command run_opts.egs_command = (args.egs_command if args.egs_command is not None else args.command) run_opts.num_jobs_compute_prior = args.num_jobs_compute_prior return [args, run_opts]
def process_args(args): """ Process the options got from get_args() """ if args.frames_per_eg < 1: raise Exception("--egs.frames-per-eg should have a minimum value of 1") if not common_train_lib.validate_minibatch_size_str(args.minibatch_size): raise Exception("--trainer.optimization.minibatch-size has an invalid value") if (not os.path.exists(args.dir)): raise Exception("This script expects --dir={0} to exist.") if (not os.path.exists(args.dir+"/configs") and (args.input_model is None or not os.path.exists(args.input_model))): raise Exception("Either --trainer.input-model option should be supplied, " "and exist; or the {0}/configs directory should exist." "{0}/configs is the output of make_configs.py" "".format(args.dir)) # set the options corresponding to args.use_gpu run_opts = common_train_lib.RunOpts() 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 for CUDA. You may be running a setup optimized for GPUs. If you have GPUs and have nvcc installed, go to src/ and do ./configure; make""") run_opts.train_queue_opt = "--gpu 1" 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={}".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.") run_opts.train_queue_opt = "" run_opts.parallel_train_opts = "--use-gpu=no" run_opts.combine_gpu_opt = "--use-gpu=no" run_opts.combine_queue_opt = "" run_opts.prior_gpu_opt = "--use-gpu=no" run_opts.prior_queue_opt = "" run_opts.command = args.command run_opts.egs_command = (args.egs_command if args.egs_command is not None else args.command) run_opts.num_jobs_compute_prior = args.num_jobs_compute_prior return [args, run_opts]
def process_args(args): """ Process the options got from get_args() """ if args.frames_per_eg < 1: raise Exception("--egs.frames-per-eg should have a minimum value of 1") if not common_train_lib.validate_minibatch_size_str(args.minibatch_size): raise Exception("--trainer.rnn.num-chunk-per-minibatch has an invalid value") if (not os.path.exists(args.dir) or (not os.path.exists(args.dir+"/configs") and not os.path.exists(args.input_model))): raise Exception("This script expects {0} to exist. Also either " "--trainer.input-model option as initial 'raw' model " "(used as 0.raw in the script) should be supplied or " "{0}/configs directory which is the output of " "make_configs.py script should be provided." "".format(args.dir)) if args.transform_dir is None: args.transform_dir = args.ali_dir # set the options corresponding to args.use_gpu run_opts = common_train_lib.RunOpts() if args.use_gpu: if not common_lib.check_if_cuda_compiled(): logger.warning( """You are running with one thread but you have not compiled for CUDA. You may be running a setup optimized for GPUs. If you have GPUs and have nvcc installed, go to src/ and do ./configure; make""") run_opts.train_queue_opt = "--gpu 1" run_opts.parallel_train_opts = "" run_opts.combine_queue_opt = "--gpu 1" run_opts.prior_gpu_opt = "--use-gpu=yes" 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.") run_opts.train_queue_opt = "" run_opts.parallel_train_opts = "--use-gpu=no" run_opts.combine_queue_opt = "" run_opts.prior_gpu_opt = "--use-gpu=no" run_opts.prior_queue_opt = "" run_opts.command = args.command run_opts.egs_command = (args.egs_command if args.egs_command is not None else args.command) run_opts.num_jobs_compute_prior = args.num_jobs_compute_prior return [args, run_opts]
def process_args(args): """ Process the options got from get_args() """ if args.frames_per_eg < 1: raise Exception("--egs.frames-per-eg should have a minimum value of 1") if not common_train_lib.validate_minibatch_size_str(args.minibatch_size): raise Exception("--trainer.rnn.num-chunk-per-minibatch has an invalid value") if (not os.path.exists(args.dir) or not os.path.exists(args.dir+"/configs")): raise Exception("This scripts expects {0} to exist and have a configs " "directory which is the output of " "make_configs.py script") if args.transform_dir is None: args.transform_dir = args.ali_dir # set the options corresponding to args.use_gpu run_opts = common_train_lib.RunOpts() if args.use_gpu: if not common_lib.check_if_cuda_compiled(): logger.warning( """You are running with one thread but you have not compiled for CUDA. You may be running a setup optimized for GPUs. If you have GPUs and have nvcc installed, go to src/ and do ./configure; make""") run_opts.train_queue_opt = "--gpu 1" run_opts.parallel_train_opts = "" run_opts.combine_gpu_opt = "" run_opts.combine_queue_opt = "--gpu 1" run_opts.prior_gpu_opt = "--use-gpu=yes" 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.") run_opts.train_queue_opt = "" run_opts.parallel_train_opts = "--use-gpu=no" run_opts.combine_gpu_opt = "--use-gpu=no" run_opts.combine_queue_opt = "" run_opts.prior_gpu_opt = "--use-gpu=no" run_opts.prior_queue_opt = "" run_opts.command = args.command run_opts.egs_command = (args.egs_command if args.egs_command is not None else args.command) run_opts.num_jobs_compute_prior = args.num_jobs_compute_prior return [args, run_opts]
def process_args(args): """ Process the options got from get_args() """ if args.frames_per_eg < 1: raise Exception("--egs.frames-per-eg should have a minimum value of 1") if not common_train_lib.validate_minibatch_size_str(args.minibatch_size): raise Exception( "--trainer.optimization.minibatch-size has an invalid value") if (not os.path.exists(args.dir) or not os.path.exists(args.dir + "/configs")): raise Exception("This scripts expects {0} to exist and have a configs " "directory which is the output of " "make_configs.py script") # set the options corresponding to args.use_gpu run_opts = common_train_lib.RunOpts() if args.use_gpu: if not common_lib.check_if_cuda_compiled(): logger.warning( """You are running with one thread but you have not compiled for CUDA. You may be running a setup optimized for GPUs. If you have GPUs and have nvcc installed, go to src/ and do ./configure; make""") run_opts.train_queue_opt = "--gpu 1" run_opts.parallel_train_opts = "" run_opts.combine_gpu_opt = "" run_opts.combine_queue_opt = "--gpu 1" run_opts.prior_gpu_opt = "--use-gpu=yes" 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.") run_opts.train_queue_opt = "" run_opts.parallel_train_opts = "--use-gpu=no" run_opts.combine_gpu_opt = "--use-gpu=no" run_opts.combine_queue_opt = "" run_opts.prior_gpu_opt = "--use-gpu=no" run_opts.prior_queue_opt = "" run_opts.command = args.command run_opts.egs_command = (args.egs_command if args.egs_command is not None else args.command) run_opts.num_jobs_compute_prior = args.num_jobs_compute_prior return [args, run_opts]
def process_args(args): """ Process the options got from get_args() """ if not common_train_lib.validate_chunk_width(args.chunk_width): raise Exception("--egs.chunk-width has an invalid value") if not common_train_lib.validate_minibatch_size_str( args.num_chunk_per_minibatch): raise Exception( "--trainer.num-chunk-per-minibatch has an invalid value") if args.chunk_left_context < 0: raise Exception("--egs.chunk-left-context should be non-negative") if args.chunk_right_context < 0: raise Exception("--egs.chunk-right-context should be non-negative") if args.left_deriv_truncate is not None: args.deriv_truncate_margin = -args.left_deriv_truncate logger.warning( "--chain.left-deriv-truncate (deprecated) is set by user, and " "--trainer.deriv-truncate-margin is set to negative of that " "value={0}. We recommend using the option " "--trainer.deriv-truncate-margin.".format( args.deriv_truncate_margin)) if (not os.path.exists(args.dir)): raise Exception("This script expects --dir={0} to exist.") if (not os.path.exists(args.dir + "/configs") and (args.input_model is None or not os.path.exists(args.input_model))): raise Exception( "Either --trainer.input-model option should be supplied, " "and exist; or the {0}/configs directory should exist." "".format(args.dir)) # set the options corresponding to args.use_gpu run_opts = common_train_lib.RunOpts() 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 for CUDA. You may be running a setup optimized for GPUs. If you have GPUs and have nvcc installed, go to src/ and do ./configure; make""") run_opts.train_queue_opt = "--gpu 1" run_opts.parallel_train_opts = "--use-gpu={}".format(args.use_gpu) run_opts.combine_queue_opt = "--gpu 1" run_opts.combine_gpu_opt = "--use-gpu={}".format(args.use_gpu) else: logger.warning("Without using a GPU this will be very slow. " "nnet3 does not yet support multiple threads.") run_opts.train_queue_opt = "" run_opts.parallel_train_opts = "--use-gpu=no" run_opts.combine_queue_opt = "" run_opts.combine_gpu_opt = "--use-gpu=no" run_opts.command = args.command run_opts.egs_command = (args.egs_command if args.egs_command is not None else args.command) return [args, run_opts]