Beispiel #1
0
    def on_show(self, sender, conf=None):
        """TODO: Docstring for on_show.

        :sender: TODO
        :conf: TODO
        :returns: TODO

        """
        self.btn_stop['text'] = 'Stop'
        self.conf = conf
        self.path = os.path.join(conf['path'], conf['id'])
        self.prel = rel_path_fact(self.path)
        self.pack()
        self.start_state()
Beispiel #2
0
def get_conf():
    """TODO: Docstring for get_conf.
    :returns: TODO

    """
    cfg_path = sys.argv[1]
    cfg_name = sys.argv[2]
    conf_db = shelve.open(cfg_path)
    conf = conf_db['trainers'][cfg_name]
    conf_db.close()
    return conf

if __name__ == '__main__':
    conf = get_conf()
    prel = rel_path_fact(os.path.join(conf['path'], conf['id']))
    os.chdir(os.path.join(conf['path'], conf['id']))

    state = getattr(experiments.nmt, state_map[conf['method']])()

    state['source'] = [prel('binarized_text.lang1.shuffle.h5')]
    state['target'] = [prel('binarized_text.lang2.shuffle.h5')]
    state['indx_word'] = prel('ivocab.lang1.pkl')
    state['indx_word_target'] = prel('ivocab.lang2.pkl')
    state['word_indx'] = prel('vocab.lang1.pkl')
    state['word_indx_trgt'] = prel('vocab.lang2.pkl')

    update_custom_keys(state, conf, ['bs', 'loopIters', 'timeStop', 'dim',
                                     'null_sym_source', 'null_sym_target'])
    if conf['method'] == 'RNNenc-50':
        state['prefix'] = 'encdec-50_'