Word2vec 模型载入(tensorflow)
2015-12-16 20:17
489 查看
opts = Options()
with tf.Graph().as_default(), tf.Session() as session:
model = Word2Vec(opts, session)
if FLAGS.interactive:
#print('load model from file %s %s', opts.save_path, os.path.join(opts.save_path, "/model.ckpt"))
#model.saver.restore(session, os.path.join(opts.save_path, "/model.ckpt"))
model.saver.restore(session, "./data/result/model.ckpt")
#print(model.nearby(['elephant']))
print('finsh model loading')
while True:
print('input your word')
word = sys.stdin.readline().strip()
print('haha')
print(model.nearby(['proton', 'elephant', 'maxwell']))
print(model.nearby([word]))
[root@cq01-forum-rstree01 embedding]# pwd
/home/users/chenghuige/other/tensorflow/bazel-bin/tensorflow/models/embedding
[root@cq01-forum-rstree01 embedding]# ./word2vec_optimized --train_data ./data/text8 --eval_data ./data/questions-words.txt --save_path ./data/result/ --interactive=1
with tf.Graph().as_default(), tf.Session() as session:
model = Word2Vec(opts, session)
if FLAGS.interactive:
#print('load model from file %s %s', opts.save_path, os.path.join(opts.save_path, "/model.ckpt"))
#model.saver.restore(session, os.path.join(opts.save_path, "/model.ckpt"))
model.saver.restore(session, "./data/result/model.ckpt")
#print(model.nearby(['elephant']))
print('finsh model loading')
while True:
print('input your word')
word = sys.stdin.readline().strip()
print('haha')
print(model.nearby(['proton', 'elephant', 'maxwell']))
print(model.nearby([word]))
[root@cq01-forum-rstree01 embedding]# pwd
/home/users/chenghuige/other/tensorflow/bazel-bin/tensorflow/models/embedding
[root@cq01-forum-rstree01 embedding]# ./word2vec_optimized --train_data ./data/text8 --eval_data ./data/questions-words.txt --save_path ./data/result/ --interactive=1
相关文章推荐
- Word2vec多线程(tensorflow)
- Android中通过typeface设置字体
- keil中code和const的区别
- 开源中最好的Web开发的资源
- CodeForces 373B
- Java WebService-CXF-基于SOAP的Web服务
- 利用软妹纸ui写的前端
- 使用eclipse发布web服务出现"Error occured when adding the module, xxxxxx, to the server"
- 1216 递归下降分析法--算数语法分析 由列志华提供
- java.lang.RuntimeException: setAudioSource failed.
- MATLAB——scatter的简单应用
- openjudge放苹果
- 上拉下拉刷新(2)网络加载图片
- You Can't Manage What You Don't Measure
- 除去pdf文件内部的超链接/a标签
- viewController的生命周期
- 设置查看java的源程序
- 【Java EE 学习 70 下】【数据采集系统第二天】【Action中User注入】【设计调查页面】【Action中模型赋值问题】【编辑调查】
- Stucts应用引起的OutOfMemoryError
- 文件查找命令―find