示例#1
0
def start_trainer(trainer_conf):
    """TODO: Docstring for start_trainer.

    :trainer_conf: TODO
    :returns: TODO

    """
    env = os.environ.copy()
    env['THEANO_FLAGS'] = conf.build_theano_env(trainer_conf)
    if trainer_conf['cores']:
        env['OMP_NUM_THREADS'] = str(trainer_conf['cores'])
    proc = Popen(['python', conf.trainer, conf.trainer_conf_path, trainer_conf['name']], env=env)
    return proc
示例#2
0
def start_trans(theano_conf, state, model, in_path, out_path):
    """TODO: Docstring for start_trans.

    :theano_conf: TODO
    :state: TODO
    :model: TODO
    :in_path: TODO
    :out_path: TODO
    :returns: TODO

    """
    env = os.environ.copy()
    env['THEANO_FLAGS'] = conf.build_theano_env(theano_conf)
    if theano_conf['cores']:
        env['OMP_NUM_THREADS'] = str(theano_conf['cores'])
    proc = Popen(['python', 'translate.py', '--beam-size', '10',
                  '--beam-search', '--state', state, '--source', in_path,
                  '--trans', out_path, model], env=env)
    return proc