提交 84ca16d9 编写于 作者: W wuzewu
# PaddleHub # PaddleHub
[![Build Status](https://travis-ci.org/PaddlePaddle/PaddleHub.svg?branch=master)](https://travis-ci.org/PaddlePaddle/PaddleHub)
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE)
...@@ -162,8 +162,6 @@ def train(use_cuda=False): ...@@ -162,8 +162,6 @@ def train(use_cuda=False):
target_vars=[predict_word], target_vars=[predict_word],
executor=exe) executor=exe)
create
dictionary = defaultdict(int) dictionary = defaultdict(int)
w_id = 0 w_id = 0
for w in word_dict: for w in word_dict:
...@@ -219,17 +217,10 @@ def test_save_module(use_cuda=False): ...@@ -219,17 +217,10 @@ def test_save_module(use_cuda=False):
dictionary[w] = w_id dictionary[w] = w_id
w_id += 1 w_id += 1
signature = hub.create_singature( signature = hub.create_signature(
"default", inputs=[data], outputs=[word_emb]) "default", inputs=[words], outputs=[word_emb])
hub.create_module( hub.create_module(
sign_arr=signature, program=main_program, path=save_module_dir) sign_arr=signature, program=main_program, path=saved_module_dir)
# input_desc = {"words": words.name}
# output_desc = {"emb": word_emb.name}
# config = hub.ModuleConfig(saved_module_dir)
# config.register_feed_signature(input_desc, sign_name="default")
# config.register_fetch_signature(output_desc, sign_name="default")
# config.save_dict(word_dict=dictionary)
# config.dump()
def test_load_module(use_cuda=False): def test_load_module(use_cuda=False):
...@@ -243,7 +234,7 @@ def test_load_module(use_cuda=False): ...@@ -243,7 +234,7 @@ def test_load_module(use_cuda=False):
if __name__ == "__main__": if __name__ == "__main__":
use_cuda = True use_cuda = False
print("train...") print("train...")
train(use_cuda) train(use_cuda)
print("save module...") print("save module...")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册