提交 fda184fd 编写于 作者: Z Zeyu Chen

remove useless python import

上级 7a1c7a7d
......@@ -17,9 +17,6 @@ from __future__ import print_function
from __future__ import division
from __future__ import print_function
from urllib.request import urlretrieve
from tqdm import tqdm
import os
import sys
import hashlib
......
# coding: utf-8
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
......@@ -163,6 +162,8 @@ def train(use_cuda=False):
target_vars=[predict_word],
executor=exe)
create
dictionary = defaultdict(int)
w_id = 0
for w in word_dict:
......@@ -218,13 +219,17 @@ def test_save_module(use_cuda=False):
dictionary[w] = w_id
w_id += 1
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()
signature = hub.create_singature(
"default", inputs=[data], outputs=[word_emb])
hub.create_module(
sign_arr=signature, program=main_program, path=save_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):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册