From fda184fdaaf6cd923455c3a03c0e6eb7a2b3d85d Mon Sep 17 00:00:00 2001 From: Zeyu Chen Date: Mon, 7 Jan 2019 17:27:35 +0800 Subject: [PATCH] remove useless python import --- paddle_hub/downloader.py | 3 --- tests/test_export_n_load_module.py | 21 +++++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/paddle_hub/downloader.py b/paddle_hub/downloader.py index cd8b8196..12eb094c 100755 --- a/paddle_hub/downloader.py +++ b/paddle_hub/downloader.py @@ -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 diff --git a/tests/test_export_n_load_module.py b/tests/test_export_n_load_module.py index cfe5107d..539ce0a5 100755 --- a/tests/test_export_n_load_module.py +++ b/tests/test_export_n_load_module.py @@ -1,4 +1,3 @@ -# 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): -- GitLab