首页 > 其他 > 详细

Word2vec 模型载入(tensorflow)

时间:2015-12-16 21:31:50      阅读:996      评论:0      收藏:0      [点我收藏+]

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

? ?

技术分享

? ?

Word2vec 模型载入(tensorflow)

原文:http://www.cnblogs.com/rocketfan/p/5052244.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!