1 Star 1 Fork 0

stonesin/w11_wordembedding_rnn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
train_eval.py 967 Bytes
一键复制 编辑 原始数据 按行查看 历史
stonesin 提交于 2018-08-26 09:45 . Upload train_eval.py sample.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from flags import parse_args
if __name__ == '__main__':
FLAGS, unparsed = parse_args()
print('current working dir [{0}]'.format(os.getcwd()))
w_d = os.path.dirname(os.path.abspath(__file__))
print('change wording dir to [{0}]'.format(w_d))
os.chdir(w_d)
cmd = ""
for parm in ["output_dir", "text", "num_steps", "batch_size", "dictionary", "reverse_dictionary", "learning_rate"]:
try:
cmd += ' --{0}={1}'.format(parm, getattr(FLAGS, parm))
except:
pass
for i in range(30):
# train 1 epoch
print('################ train ################')
p = os.popen('python ./train.py' + cmd)
for l in p:
print(l.strip())
# eval
print('################ eval ################')
p = os.popen('python ./sample.py' + cmd)
for l in p:
print(l.strip())
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/laver9/w11_wordembedding_rnn.git
[email protected]:laver9/w11_wordembedding_rnn.git
laver9
w11_wordembedding_rnn
w11_wordembedding_rnn
master

搜索帮助