From 37ed4ebb783dfdbd5eefa73dee5566a328d2c877 Mon Sep 17 00:00:00 2001 From: wuzewu Date: Wed, 3 Apr 2019 20:20:29 +0800 Subject: [PATCH] rename paddle_hub to paddlehub --- README.md | 2 +- .../ernie-classification/finetune_with_hub.py | 2 +- demo/image-classification/create_module.py | 5 +++- demo/image-classification/infer.sh | 2 +- demo/image-classification/processor.py | 8 ++++--- demo/image-classification/retrain.py | 5 ++-- demo/lac/create_module.py | 2 +- demo/lac/infer.sh | 2 +- demo/lac/infer_by_code.py | 2 +- demo/lac/processor.py | 4 ++-- demo/senta/create_module.py | 2 +- demo/senta/infer.sh | 2 +- demo/senta/infer_by_code.py | 2 +- demo/senta/processor.py | 2 +- demo/ssd/create_module.py | 2 +- demo/ssd/infer.sh | 2 +- demo/ssd/infer_by_code.py | 2 +- demo/ssd/processor.py | 4 ++-- docs/transfer_learning_turtorial.md | 2 +- {paddle_hub => paddlehub}/__init__.py | 0 .../commands/__init__.py | 0 .../commands/base_command.py | 4 +++- .../commands/download.py | 12 ++++++---- {paddle_hub => paddlehub}/commands/help.py | 3 ++- {paddle_hub => paddlehub}/commands/hub.py | 16 +++++++------ {paddle_hub => paddlehub}/commands/install.py | 8 +++---- {paddle_hub => paddlehub}/commands/list.py | 10 ++++---- {paddle_hub => paddlehub}/commands/run.py | 16 ++++++------- {paddle_hub => paddlehub}/commands/search.py | 13 ++++++---- {paddle_hub => paddlehub}/commands/show.py | 10 ++++---- .../commands/uninstall.py | 8 +++---- {paddle_hub => paddlehub}/commands/version.py | 6 ++--- {paddle_hub => paddlehub}/common/__init__.py | 0 .../common/arg_helper.py | 4 +++- {paddle_hub => paddlehub}/common/dir.py | 0 .../common/downloader.py | 6 ++--- .../common/hub_server.py | 10 ++++---- {paddle_hub => paddlehub}/common/logger.py | 1 + .../common/paddle_helper.py | 8 ++++--- {paddle_hub => paddlehub}/common/utils.py | 13 +++++----- {paddle_hub => paddlehub}/dataset/__init__.py | 0 .../dataset/base_cv_dataset.py | 4 ++-- .../dataset/chnsenticorp.py | 11 ++++----- {paddle_hub => paddlehub}/dataset/dataset.py | 0 {paddle_hub => paddlehub}/dataset/dogcat.py | 4 ++-- {paddle_hub => paddlehub}/dataset/flowers.py | 4 ++-- {paddle_hub => paddlehub}/dataset/msra_ner.py | 6 ++--- .../finetune/__init__.py | 0 .../finetune/checkpoint.proto | 0 .../finetune/checkpoint.py | 4 ++-- .../finetune/checkpoint_pb2.py | 0 {paddle_hub => paddlehub}/finetune/config.py | 7 +++--- .../finetune/finetune.py | 10 ++++---- {paddle_hub => paddlehub}/finetune/network.py | 7 +++--- .../finetune/optimization.py | 0 .../finetune/strategy.py | 2 +- {paddle_hub => paddlehub}/finetune/task.py | 5 ++-- {paddle_hub => paddlehub}/io/__init__.py | 0 {paddle_hub => paddlehub}/io/augmentation.py | 4 +++- {paddle_hub => paddlehub}/io/postprocess.py | 0 {paddle_hub => paddlehub}/io/preprocess.py | 0 {paddle_hub => paddlehub}/io/reader.py | 0 {paddle_hub => paddlehub}/io/type.py | 6 +++-- {paddle_hub => paddlehub}/module/__init__.py | 0 .../module/base_processor.py | 0 .../module/check_info.proto | 0 .../module/check_info_pb2.py | 0 {paddle_hub => paddlehub}/module/checker.py | 9 ++++--- {paddle_hub => paddlehub}/module/manager.py | 8 +++---- {paddle_hub => paddlehub}/module/module.py | 24 +++++++++---------- .../module/module_desc.proto | 0 .../module/module_desc_pb2.py | 0 {paddle_hub => paddlehub}/module/signature.py | 4 +++- {paddle_hub => paddlehub}/reader/__init__.py | 0 {paddle_hub => paddlehub}/reader/batching.py | 0 {paddle_hub => paddlehub}/reader/cv_reader.py | 2 +- .../reader/nlp_reader.py | 6 ++--- .../reader/tokenization.py | 0 {paddle_hub => paddlehub}/version.py | 0 scripts/gen_proto.sh | 6 ++--- setup.py | 8 +++---- tests/test_downloader.py | 2 +- tests/test_export_n_load_module.py | 2 +- tests/test_module.py | 2 +- tests/test_param_serialize.py | 8 +++---- tests/test_pyobj_serialize.py | 8 +++---- tests/test_signature.py | 4 ++-- tests/test_train_w2v.py | 2 +- 88 files changed, 202 insertions(+), 169 deletions(-) rename {paddle_hub => paddlehub}/__init__.py (100%) rename {paddle_hub => paddlehub}/commands/__init__.py (100%) rename {paddle_hub => paddlehub}/commands/base_command.py (96%) rename {paddle_hub => paddlehub}/commands/download.py (91%) rename {paddle_hub => paddlehub}/commands/help.py (96%) rename {paddle_hub => paddlehub}/commands/hub.py (83%) rename {paddle_hub => paddlehub}/commands/install.py (90%) rename {paddle_hub => paddlehub}/commands/list.py (84%) rename {paddle_hub => paddlehub}/commands/run.py (94%) rename {paddle_hub => paddlehub}/commands/search.py (84%) rename {paddle_hub => paddlehub}/commands/show.py (91%) rename {paddle_hub => paddlehub}/commands/uninstall.py (88%) rename {paddle_hub => paddlehub}/commands/version.py (89%) rename {paddle_hub => paddlehub}/common/__init__.py (100%) rename {paddle_hub => paddlehub}/common/arg_helper.py (96%) rename {paddle_hub => paddlehub}/common/dir.py (100%) rename {paddle_hub => paddlehub}/common/downloader.py (97%) rename {paddle_hub => paddlehub}/common/hub_server.py (97%) rename {paddle_hub => paddlehub}/common/logger.py (99%) rename {paddle_hub => paddlehub}/common/paddle_helper.py (98%) rename {paddle_hub => paddlehub}/common/utils.py (98%) rename {paddle_hub => paddlehub}/dataset/__init__.py (100%) rename {paddle_hub => paddlehub}/dataset/base_cv_dataset.py (96%) rename {paddle_hub => paddlehub}/dataset/chnsenticorp.py (93%) rename {paddle_hub => paddlehub}/dataset/dataset.py (100%) rename {paddle_hub => paddlehub}/dataset/dogcat.py (92%) rename {paddle_hub => paddlehub}/dataset/flowers.py (92%) rename {paddle_hub => paddlehub}/dataset/msra_ner.py (95%) rename {paddle_hub => paddlehub}/finetune/__init__.py (100%) rename {paddle_hub => paddlehub}/finetune/checkpoint.proto (100%) rename {paddle_hub => paddlehub}/finetune/checkpoint.py (96%) rename {paddle_hub => paddlehub}/finetune/checkpoint_pb2.py (100%) rename {paddle_hub => paddlehub}/finetune/config.py (96%) rename {paddle_hub => paddlehub}/finetune/finetune.py (97%) rename {paddle_hub => paddlehub}/finetune/network.py (98%) rename {paddle_hub => paddlehub}/finetune/optimization.py (100%) rename {paddle_hub => paddlehub}/finetune/strategy.py (98%) rename {paddle_hub => paddlehub}/finetune/task.py (99%) rename {paddle_hub => paddlehub}/io/__init__.py (100%) rename {paddle_hub => paddlehub}/io/augmentation.py (99%) rename {paddle_hub => paddlehub}/io/postprocess.py (100%) rename {paddle_hub => paddlehub}/io/preprocess.py (100%) rename {paddle_hub => paddlehub}/io/reader.py (100%) rename {paddle_hub => paddlehub}/io/type.py (95%) rename {paddle_hub => paddlehub}/module/__init__.py (100%) rename {paddle_hub => paddlehub}/module/base_processor.py (100%) rename {paddle_hub => paddlehub}/module/check_info.proto (100%) rename {paddle_hub => paddlehub}/module/check_info_pb2.py (100%) rename {paddle_hub => paddlehub}/module/checker.py (97%) rename {paddle_hub => paddlehub}/module/manager.py (95%) rename {paddle_hub => paddlehub}/module/module.py (97%) rename {paddle_hub => paddlehub}/module/module_desc.proto (100%) rename {paddle_hub => paddlehub}/module/module_desc_pb2.py (100%) rename {paddle_hub => paddlehub}/module/signature.py (98%) rename {paddle_hub => paddlehub}/reader/__init__.py (100%) rename {paddle_hub => paddlehub}/reader/batching.py (100%) rename {paddle_hub => paddlehub}/reader/cv_reader.py (98%) rename {paddle_hub => paddlehub}/reader/nlp_reader.py (98%) rename {paddle_hub => paddlehub}/reader/tokenization.py (100%) rename {paddle_hub => paddlehub}/version.py (100%) diff --git a/README.md b/README.md index 30e1d571..bb2b1d1d 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ PaddleHub旨在为PaddlePaddle提供一个简明易用的预训练模型管理 # 安装 paddle hub直接通过pip进行安装(python3以上),使用如下命令来安装paddle hub ``` -pip install paddle_hub +pip install paddlehub ``` # 快速体验 通过下面的命令,来体验下paddle hub的魅力 diff --git a/demo/ernie-classification/finetune_with_hub.py b/demo/ernie-classification/finetune_with_hub.py index ef291a48..0e82da17 100644 --- a/demo/ernie-classification/finetune_with_hub.py +++ b/demo/ernie-classification/finetune_with_hub.py @@ -24,7 +24,7 @@ import numpy as np import paddle import paddle.fluid as fluid -import paddle_hub as hub +import paddlehub as hub # yapf: disable parser = argparse.ArgumentParser(__doc__) diff --git a/demo/image-classification/create_module.py b/demo/image-classification/create_module.py index 652ce773..3015066b 100644 --- a/demo/image-classification/create_module.py +++ b/demo/image-classification/create_module.py @@ -1,13 +1,16 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function + import os import functools import argparse + import paddle import paddle.fluid as fluid + import nets -import paddle_hub as hub +import paddlehub as hub import processor from utility import add_arguments, print_arguments parser = argparse.ArgumentParser(description=__doc__) diff --git a/demo/image-classification/infer.sh b/demo/image-classification/infer.sh index 47b1486f..6aff1d77 100644 --- a/demo/image-classification/infer.sh +++ b/demo/image-classification/infer.sh @@ -1 +1 @@ -python ../../paddle_hub/commands/hub.py run hub_module_ResNet50/ --signature classification --config resources/test/test.yml --dataset resources/test/test.csv +python ../../paddlehub/commands/hub.py run hub_module_ResNet50/ --signature classification --config resources/test/test.yml --dataset resources/test/test.csv diff --git a/demo/image-classification/processor.py b/demo/image-classification/processor.py index b5faf1e0..66ff7e44 100644 --- a/demo/image-classification/processor.py +++ b/demo/image-classification/processor.py @@ -1,10 +1,12 @@ +import os + import paddle -import paddle_hub as hub import numpy as np -import os -from paddle_hub import BaseProcessor from PIL import Image +from paddlehub import BaseProcessor +import paddlehub as hub + DATA_DIM = 224 img_mean = np.array([0.485, 0.456, 0.406]).reshape((3, 1, 1)) img_std = np.array([0.229, 0.224, 0.225]).reshape((3, 1, 1)) diff --git a/demo/image-classification/retrain.py b/demo/image-classification/retrain.py index 8f07a6f7..77350776 100644 --- a/demo/image-classification/retrain.py +++ b/demo/image-classification/retrain.py @@ -1,10 +1,11 @@ -import paddle_hub as hub import paddle import paddle.fluid as fluid +import paddlehub as hub + def train(): - resnet_module = hub.Module(name="resnet50_imagenet") + resnet_module = hub.Module(module_dir="hub_module_ResNet50") input_dict, output_dict, program = resnet_module.context( sign_name="feature_map", trainable=True) dataset = hub.dataset.Flowers() diff --git a/demo/lac/create_module.py b/demo/lac/create_module.py index 564f7e98..a7710e37 100644 --- a/demo/lac/create_module.py +++ b/demo/lac/create_module.py @@ -2,7 +2,7 @@ import numpy as np import paddle import paddle.fluid as fluid import reader -import paddle_hub as hub +import paddlehub as hub import processor import os from network import lex_net diff --git a/demo/lac/infer.sh b/demo/lac/infer.sh index 6416781a..d76a7398 100644 --- a/demo/lac/infer.sh +++ b/demo/lac/infer.sh @@ -1 +1 @@ -python ../../paddle_hub/commands/hub.py run hub_module_lac/ --signature lexical_analysis --config resources/test/test.yml --input_file resources/test/test.csv +python ../../paddlehub/commands/hub.py run hub_module_lac/ --signature lexical_analysis --config resources/test/test.yml --input_file resources/test/test.csv diff --git a/demo/lac/infer_by_code.py b/demo/lac/infer_by_code.py index a1542860..2c8a66de 100644 --- a/demo/lac/infer_by_code.py +++ b/demo/lac/infer_by_code.py @@ -1,5 +1,5 @@ import os -import paddle_hub as hub +import paddlehub as hub def infer_with_input_text(): diff --git a/demo/lac/processor.py b/demo/lac/processor.py index e162908a..16530f48 100644 --- a/demo/lac/processor.py +++ b/demo/lac/processor.py @@ -1,10 +1,10 @@ import paddle import paddle.fluid as fluid -import paddle_hub as hub +import paddlehub as hub import numpy as np import os import io -from paddle_hub import BaseProcessor +from paddlehub import BaseProcessor class Processor(BaseProcessor): diff --git a/demo/senta/create_module.py b/demo/senta/create_module.py index 043731b2..cc500410 100644 --- a/demo/senta/create_module.py +++ b/demo/senta/create_module.py @@ -3,7 +3,7 @@ import paddle.fluid as fluid import processor import numpy as np import nets -import paddle_hub as hub +import paddlehub as hub def load_vocab(file_path): diff --git a/demo/senta/infer.sh b/demo/senta/infer.sh index f71ba312..2cba3792 100644 --- a/demo/senta/infer.sh +++ b/demo/senta/infer.sh @@ -1 +1 @@ -python ../../paddle_hub/commands/hub.py run hub_module_senta/ --signature sentiment_classify --config resources/test/test.yml --dataset resources/test/test.csv +python ../../paddlehub/commands/hub.py run hub_module_senta/ --signature sentiment_classify --config resources/test/test.yml --dataset resources/test/test.csv diff --git a/demo/senta/infer_by_code.py b/demo/senta/infer_by_code.py index d814e4fb..36b9fad6 100644 --- a/demo/senta/infer_by_code.py +++ b/demo/senta/infer_by_code.py @@ -1,5 +1,5 @@ import os -import paddle_hub as hub +import paddlehub as hub def infer_with_input_text(): diff --git a/demo/senta/processor.py b/demo/senta/processor.py index 5c523138..4bb0e00e 100644 --- a/demo/senta/processor.py +++ b/demo/senta/processor.py @@ -5,7 +5,7 @@ import paddle import paddle.fluid as fluid import numpy as np -import paddle_hub as hub +import paddlehub as hub def load_vocab(file_path): diff --git a/demo/ssd/create_module.py b/demo/ssd/create_module.py index 6864c470..c35c6b1d 100644 --- a/demo/ssd/create_module.py +++ b/demo/ssd/create_module.py @@ -1,7 +1,7 @@ import os import numpy as np import processor -import paddle_hub as hub +import paddlehub as hub import paddle import paddle.fluid as fluid from mobilenet_ssd import mobile_net diff --git a/demo/ssd/infer.sh b/demo/ssd/infer.sh index 7ad3a71d..02a1a019 100644 --- a/demo/ssd/infer.sh +++ b/demo/ssd/infer.sh @@ -1 +1 @@ -python ../../paddle_hub/commands/hub.py run hub_module_ssd/ --signature object_detection --config resources/test/test.yml --dataset resources/test/test.csv +python ../../paddlehub/commands/hub.py run hub_module_ssd/ --signature object_detection --config resources/test/test.yml --dataset resources/test/test.csv diff --git a/demo/ssd/infer_by_code.py b/demo/ssd/infer_by_code.py index 063e7a87..0dc6cf3f 100644 --- a/demo/ssd/infer_by_code.py +++ b/demo/ssd/infer_by_code.py @@ -1,5 +1,5 @@ import os -import paddle_hub as hub +import paddlehub as hub def infer_with_input_text(): diff --git a/demo/ssd/processor.py b/demo/ssd/processor.py index cd88b633..4b9aea86 100644 --- a/demo/ssd/processor.py +++ b/demo/ssd/processor.py @@ -1,8 +1,8 @@ import paddle -import paddle_hub as hub +import paddlehub as hub import numpy as np import os -from paddle_hub import BaseProcessor +from paddlehub import BaseProcessor from PIL import Image from PIL import ImageDraw from PIL import ImageFont diff --git a/docs/transfer_learning_turtorial.md b/docs/transfer_learning_turtorial.md index 5c36c26c..ee4fb16e 100644 --- a/docs/transfer_learning_turtorial.md +++ b/docs/transfer_learning_turtorial.md @@ -20,7 +20,7 @@ http://ftp.cs.wisc.edu/machine-learning/shavlik-group/torrey.handbook09.pdf ## CV教程 以猫狗分类为例子,我们可以快速的使用一个通过ImageNet训练过的ResNet进行finetune ```python -import paddle_hub as hub +import paddlehub as hub import paddle import paddle.fluid as fluid diff --git a/paddle_hub/__init__.py b/paddlehub/__init__.py similarity index 100% rename from paddle_hub/__init__.py rename to paddlehub/__init__.py diff --git a/paddle_hub/commands/__init__.py b/paddlehub/commands/__init__.py similarity index 100% rename from paddle_hub/commands/__init__.py rename to paddlehub/commands/__init__.py diff --git a/paddle_hub/commands/base_command.py b/paddlehub/commands/base_command.py similarity index 96% rename from paddle_hub/commands/base_command.py rename to paddlehub/commands/base_command.py index 8d423a8f..f7eaddad 100644 --- a/paddle_hub/commands/base_command.py +++ b/paddlehub/commands/base_command.py @@ -15,9 +15,11 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.common.arg_helper import add_argument, print_arguments + import argparse +from paddlehub.common.arg_helper import add_argument, print_arguments + ENTRY = "hub" diff --git a/paddle_hub/commands/download.py b/paddlehub/commands/download.py similarity index 91% rename from paddle_hub/commands/download.py rename to paddlehub/commands/download.py index ff693d30..0b935a3a 100644 --- a/paddle_hub/commands/download.py +++ b/paddlehub/commands/download.py @@ -15,13 +15,15 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.common.logger import logger -from paddle_hub.commands.base_command import BaseCommand, ENTRY -from paddle_hub.common import utils -from paddle_hub.common.downloader import default_downloader -from paddle_hub.common.hub_server import default_hub_server + import argparse +from paddlehub.common.logger import logger +from paddlehub.common import utils +from paddlehub.common.downloader import default_downloader +from paddlehub.common.hub_server import default_hub_server +from paddlehub.commands.base_command import BaseCommand, ENTRY + class DownloadCommand(BaseCommand): name = "download" diff --git a/paddle_hub/commands/help.py b/paddlehub/commands/help.py similarity index 96% rename from paddle_hub/commands/help.py rename to paddlehub/commands/help.py index 11324f95..9534a95a 100644 --- a/paddle_hub/commands/help.py +++ b/paddlehub/commands/help.py @@ -15,7 +15,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.commands.base_command import BaseCommand + +from paddlehub.commands.base_command import BaseCommand class HelpCommand(BaseCommand): diff --git a/paddle_hub/commands/hub.py b/paddlehub/commands/hub.py similarity index 83% rename from paddle_hub/commands/hub.py rename to paddlehub/commands/hub.py index 40bd7451..f2ce422a 100644 --- a/paddle_hub/commands/hub.py +++ b/paddlehub/commands/hub.py @@ -15,15 +15,17 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.common.logger import logger -from paddle_hub.commands.base_command import BaseCommand -from paddle_hub.commands import show -from paddle_hub.commands import help -from paddle_hub.commands import version -from paddle_hub.commands import run -from paddle_hub.commands import download + import sys +from paddlehub.common.logger import logger +from paddlehub.commands.base_command import BaseCommand +from paddlehub.commands import show +from paddlehub.commands import help +from paddlehub.commands import version +from paddlehub.commands import run +from paddlehub.commands import download + class HubCommand(BaseCommand): name = "hub" diff --git a/paddle_hub/commands/install.py b/paddlehub/commands/install.py similarity index 90% rename from paddle_hub/commands/install.py rename to paddlehub/commands/install.py index eb3fd9aa..1ce0b6ad 100644 --- a/paddle_hub/commands/install.py +++ b/paddlehub/commands/install.py @@ -17,10 +17,10 @@ from __future__ import print_function import argparse -from paddle_hub.common.logger import logger -from paddle_hub.commands.base_command import BaseCommand, ENTRY -from paddle_hub.common import utils -from paddle_hub.module.manager import default_module_manager +from paddlehub.common.logger import logger +from paddlehub.common import utils +from paddlehub.module.manager import default_module_manager +from paddlehub.commands.base_command import BaseCommand, ENTRY class InstallCommand(BaseCommand): diff --git a/paddle_hub/commands/list.py b/paddlehub/commands/list.py similarity index 84% rename from paddle_hub/commands/list.py rename to paddlehub/commands/list.py index 1b8d692b..b7d68e99 100644 --- a/paddle_hub/commands/list.py +++ b/paddlehub/commands/list.py @@ -16,11 +16,11 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.common.logger import logger -from paddle_hub.commands.base_command import BaseCommand -from paddle_hub.common import utils -from paddle_hub.common.downloader import default_downloader -from paddle_hub.module.manager import default_module_manager +from paddlehub.common.logger import logger +from paddlehub.common import utils +from paddlehub.common.downloader import default_downloader +from paddlehub.module.manager import default_module_manager +from paddlehub.commands.base_command import BaseCommand class ListCommand(BaseCommand): diff --git a/paddle_hub/commands/run.py b/paddlehub/commands/run.py similarity index 94% rename from paddle_hub/commands/run.py rename to paddlehub/commands/run.py index 3fe8f1a2..1b6249bf 100644 --- a/paddle_hub/commands/run.py +++ b/paddlehub/commands/run.py @@ -16,17 +16,17 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.common.logger import logger -from paddle_hub.commands.base_command import BaseCommand, ENTRY -from paddle_hub.io.reader import csv_reader, yaml_reader -from paddle_hub.module.manager import default_module_manager -from paddle_hub.common import utils -from paddle_hub.common.arg_helper import add_argument, print_arguments - -import paddle_hub as hub import argparse import os +from paddlehub.common.logger import logger +from paddlehub.commands.base_command import BaseCommand, ENTRY +from paddlehub.io.reader import csv_reader, yaml_reader +from paddlehub.module.manager import default_module_manager +from paddlehub.common import utils +from paddlehub.common.arg_helper import add_argument, print_arguments +import paddlehub as hub + class RunCommand(BaseCommand): name = "run" diff --git a/paddle_hub/commands/search.py b/paddlehub/commands/search.py similarity index 84% rename from paddle_hub/commands/search.py rename to paddlehub/commands/search.py index 801ef132..588cb114 100644 --- a/paddle_hub/commands/search.py +++ b/paddlehub/commands/search.py @@ -15,12 +15,14 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.common.logger import logger -from paddle_hub.commands.base_command import BaseCommand, ENTRY -from paddle_hub.common import utils -from paddle_hub.common.hub_server import default_hub_server + import argparse +from paddlehub.common.logger import logger +from paddlehub.common import utils +from paddlehub.common.hub_server import default_hub_server +from paddlehub.commands.base_command import BaseCommand, ENTRY + class SearchCommand(BaseCommand): name = "search" @@ -44,7 +46,8 @@ class SearchCommand(BaseCommand): module_name = argv[0] module_list = default_hub_server.search_module(module_name) text = "\n" - text += " %-20s\t\t%s\n" % ("ModuleName", "ModuleVersion") + text += color_bold_text( + "red", " %-20s\t\t%s\n" % ("ModuleName", "ModuleVersion")) text += " %-20s\t\t%s\n" % ("--", "--") for module_name, module_version in module_list: text += " %-20s\t\t%s\n" % (module_name, module_version) diff --git a/paddle_hub/commands/show.py b/paddlehub/commands/show.py similarity index 91% rename from paddle_hub/commands/show.py rename to paddlehub/commands/show.py index 58ed0bfd..ed15b563 100644 --- a/paddle_hub/commands/show.py +++ b/paddlehub/commands/show.py @@ -19,11 +19,11 @@ from __future__ import print_function import os import argparse -from paddle_hub.common.logger import logger -from paddle_hub.commands.base_command import BaseCommand, ENTRY -from paddle_hub.module.manager import default_module_manager -from paddle_hub.module.module import Module -from paddle_hub.io.reader import yaml_reader +from paddlehub.common.logger import logger +from paddlehub.commands.base_command import BaseCommand, ENTRY +from paddlehub.module.manager import default_module_manager +from paddlehub.module.module import Module +from paddlehub.io.reader import yaml_reader class ShowCommand(BaseCommand): diff --git a/paddle_hub/commands/uninstall.py b/paddlehub/commands/uninstall.py similarity index 88% rename from paddle_hub/commands/uninstall.py rename to paddlehub/commands/uninstall.py index e89d971a..b9652d25 100644 --- a/paddle_hub/commands/uninstall.py +++ b/paddlehub/commands/uninstall.py @@ -18,10 +18,10 @@ from __future__ import print_function import argparse -from paddle_hub.common.logger import logger -from paddle_hub.commands.base_command import BaseCommand, ENTRY -from paddle_hub.common import utils -from paddle_hub.module.manager import default_module_manager +from paddlehub.common.logger import logger +from paddlehub.common import utils +from paddlehub.module.manager import default_module_manager +from paddlehub.commands.base_command import BaseCommand, ENTRY class UninstallCommand(BaseCommand): diff --git a/paddle_hub/commands/version.py b/paddlehub/commands/version.py similarity index 89% rename from paddle_hub/commands/version.py rename to paddlehub/commands/version.py index d840b407..b0c1696c 100644 --- a/paddle_hub/commands/version.py +++ b/paddlehub/commands/version.py @@ -16,9 +16,9 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.common.logger import logger -from paddle_hub.commands.base_command import BaseCommand -from paddle_hub import version +from paddlehub.common.logger import logger +from paddlehub import version +from paddlehub.commands.base_command import BaseCommand class VersionCommand(BaseCommand): diff --git a/paddle_hub/common/__init__.py b/paddlehub/common/__init__.py similarity index 100% rename from paddle_hub/common/__init__.py rename to paddlehub/common/__init__.py diff --git a/paddle_hub/common/arg_helper.py b/paddlehub/common/arg_helper.py similarity index 96% rename from paddle_hub/common/arg_helper.py rename to paddlehub/common/arg_helper.py index a23b15e9..c5cff835 100644 --- a/paddle_hub/common/arg_helper.py +++ b/paddlehub/common/arg_helper.py @@ -15,10 +15,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.common.logger import logger + import six import distutils.util +from paddlehub.common.logger import logger + def add_argument(argument, type, default, help, argparser, **kwargs): type = distutils.util.strtobool if type == bool else type diff --git a/paddle_hub/common/dir.py b/paddlehub/common/dir.py similarity index 100% rename from paddle_hub/common/dir.py rename to paddlehub/common/dir.py diff --git a/paddle_hub/common/downloader.py b/paddlehub/common/downloader.py similarity index 97% rename from paddle_hub/common/downloader.py rename to paddlehub/common/downloader.py index fcd899df..b79ae865 100644 --- a/paddle_hub/common/downloader.py +++ b/paddlehub/common/downloader.py @@ -26,9 +26,9 @@ import requests import tempfile import tarfile -from paddle_hub.common import utils -from paddle_hub.common.logger import logger -from paddle_hub.io.reader import csv_reader +from paddlehub.common import utils +from paddlehub.common.logger import logger +from paddlehub.io.reader import csv_reader __all__ = ['Downloader'] FLUSH_INTERVAL = 0.1 diff --git a/paddle_hub/common/hub_server.py b/paddlehub/common/hub_server.py similarity index 97% rename from paddle_hub/common/hub_server.py rename to paddlehub/common/hub_server.py index cca2d97a..6e5ebe4e 100644 --- a/paddle_hub/common/hub_server.py +++ b/paddlehub/common/hub_server.py @@ -15,12 +15,14 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.common import utils -from paddle_hub.common.downloader import default_downloader -from paddle_hub.io.reader import csv_reader + import os import time -import paddle_hub as hub + +from paddlehub.common import utils +from paddlehub.common.downloader import default_downloader +from paddlehub.io.reader import csv_reader +import paddlehub as hub MODULE_LIST_FILE = "module_list_file.csv" MODEL_LIST_FILE = "model_list_file.csv" diff --git a/paddle_hub/common/logger.py b/paddlehub/common/logger.py similarity index 99% rename from paddle_hub/common/logger.py rename to paddlehub/common/logger.py index 61e3c8e8..d04913a8 100644 --- a/paddle_hub/common/logger.py +++ b/paddlehub/common/logger.py @@ -15,6 +15,7 @@ from __future__ import print_function from __future__ import division from __future__ import print_function + import logging import math diff --git a/paddle_hub/common/paddle_helper.py b/paddlehub/common/paddle_helper.py similarity index 98% rename from paddle_hub/common/paddle_helper.py rename to paddlehub/common/paddle_helper.py index 6cf386f6..4fe1c97b 100644 --- a/paddle_hub/common/paddle_helper.py +++ b/paddlehub/common/paddle_helper.py @@ -15,13 +15,15 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from ..module import module_desc_pb2 -from .utils import from_pyobj_to_module_attr, from_module_attr_to_pyobj -from .logger import logger + import paddle import paddle.fluid as fluid import copy +from paddlehub.module import module_desc_pb2 +from paddlehub.common.utils import from_pyobj_to_module_attr, from_module_attr_to_pyobj +from paddlehub.common.logger import logger + def get_variable_info(var): assert isinstance( diff --git a/paddle_hub/common/utils.py b/paddlehub/common/utils.py similarity index 98% rename from paddle_hub/common/utils.py rename to paddlehub/common/utils.py index 80ed69fb..7ff79f09 100644 --- a/paddle_hub/common/utils.py +++ b/paddlehub/common/utils.py @@ -12,18 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -# coding=utf-8 - from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.module import module_desc_pb2 -from paddle_hub.common.logger import logger -import paddle -import paddle.fluid as fluid + import os import hashlib +import paddle +import paddle.fluid as fluid + +from paddlehub.module import module_desc_pb2 +from paddlehub.common.logger import logger + def to_list(input): if not isinstance(input, list): diff --git a/paddle_hub/dataset/__init__.py b/paddlehub/dataset/__init__.py similarity index 100% rename from paddle_hub/dataset/__init__.py rename to paddlehub/dataset/__init__.py diff --git a/paddle_hub/dataset/base_cv_dataset.py b/paddlehub/dataset/base_cv_dataset.py similarity index 96% rename from paddle_hub/dataset/base_cv_dataset.py rename to paddlehub/dataset/base_cv_dataset.py index a0f811c9..07b050c7 100644 --- a/paddle_hub/dataset/base_cv_dataset.py +++ b/paddlehub/dataset/base_cv_dataset.py @@ -18,8 +18,8 @@ from __future__ import print_function import os -import paddle_hub as hub -from paddle_hub.common.downloader import default_downloader +import paddlehub as hub +from paddlehub.common.downloader import default_downloader class ImageClassificationDataset: diff --git a/paddle_hub/dataset/chnsenticorp.py b/paddlehub/dataset/chnsenticorp.py similarity index 93% rename from paddle_hub/dataset/chnsenticorp.py rename to paddlehub/dataset/chnsenticorp.py index b81c8de2..3cb879dd 100644 --- a/paddle_hub/dataset/chnsenticorp.py +++ b/paddlehub/dataset/chnsenticorp.py @@ -12,15 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle_hub.common.downloader import default_downloader -from paddle_hub.common.dir import DATA_HOME - +from collections import namedtuple import os import csv -from paddle_hub.dataset import InputExample -from paddle_hub.dataset import HubDataset -from collections import namedtuple +from paddlehub.dataset import InputExample +from paddlehub.dataset import HubDataset +from paddlehub.common.downloader import default_downloader +from paddlehub.common.dir import DATA_HOME DATA_URL = "https://paddlehub-dataset.bj.bcebos.com/chnsenticorp_data.tar.gz" diff --git a/paddle_hub/dataset/dataset.py b/paddlehub/dataset/dataset.py similarity index 100% rename from paddle_hub/dataset/dataset.py rename to paddlehub/dataset/dataset.py diff --git a/paddle_hub/dataset/dogcat.py b/paddlehub/dataset/dogcat.py similarity index 92% rename from paddle_hub/dataset/dogcat.py rename to paddlehub/dataset/dogcat.py index 7ceb9e90..3bdca560 100644 --- a/paddle_hub/dataset/dogcat.py +++ b/paddlehub/dataset/dogcat.py @@ -18,8 +18,8 @@ from __future__ import print_function import os -import paddle_hub as hub -from paddle_hub.dataset.base_cv_dataset import ImageClassificationDataset +import paddlehub as hub +from paddlehub.dataset.base_cv_dataset import ImageClassificationDataset class DogCatDataset(ImageClassificationDataset): diff --git a/paddle_hub/dataset/flowers.py b/paddlehub/dataset/flowers.py similarity index 92% rename from paddle_hub/dataset/flowers.py rename to paddlehub/dataset/flowers.py index b14927ec..8f7a02c0 100644 --- a/paddle_hub/dataset/flowers.py +++ b/paddlehub/dataset/flowers.py @@ -18,8 +18,8 @@ from __future__ import print_function import os -import paddle_hub as hub -from paddle_hub.dataset.base_cv_dataset import ImageClassificationDataset +import paddlehub as hub +from paddlehub.dataset.base_cv_dataset import ImageClassificationDataset class FlowersDataset(ImageClassificationDataset): diff --git a/paddle_hub/dataset/msra_ner.py b/paddlehub/dataset/msra_ner.py similarity index 95% rename from paddle_hub/dataset/msra_ner.py rename to paddlehub/dataset/msra_ner.py index b9d2fcd2..53a45fd5 100644 --- a/paddle_hub/dataset/msra_ner.py +++ b/paddlehub/dataset/msra_ner.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle_hub.common.downloader import default_downloader -from paddle_hub.common.dir import DATA_HOME - import os import csv import json from collections import namedtuple +from paddlehub.common.downloader import default_downloader +from paddlehub.common.dir import DATA_HOME + DATA_URL = "https://paddlehub-dataset.bj.bcebos.com/msra_ner.tar.gz" diff --git a/paddle_hub/finetune/__init__.py b/paddlehub/finetune/__init__.py similarity index 100% rename from paddle_hub/finetune/__init__.py rename to paddlehub/finetune/__init__.py diff --git a/paddle_hub/finetune/checkpoint.proto b/paddlehub/finetune/checkpoint.proto similarity index 100% rename from paddle_hub/finetune/checkpoint.proto rename to paddlehub/finetune/checkpoint.proto diff --git a/paddle_hub/finetune/checkpoint.py b/paddlehub/finetune/checkpoint.py similarity index 96% rename from paddle_hub/finetune/checkpoint.py rename to paddlehub/finetune/checkpoint.py index 5609767a..4fa987df 100644 --- a/paddle_hub/finetune/checkpoint.py +++ b/paddlehub/finetune/checkpoint.py @@ -20,8 +20,8 @@ import os import paddle.fluid as fluid -from paddle_hub.finetune import checkpoint_pb2 -from paddle_hub.common.logger import logger +from paddlehub.finetune import checkpoint_pb2 +from paddlehub.common.logger import logger CKPT_FILE_NAME = "ckpt.meta" diff --git a/paddle_hub/finetune/checkpoint_pb2.py b/paddlehub/finetune/checkpoint_pb2.py similarity index 100% rename from paddle_hub/finetune/checkpoint_pb2.py rename to paddlehub/finetune/checkpoint_pb2.py diff --git a/paddle_hub/finetune/config.py b/paddlehub/finetune/config.py similarity index 96% rename from paddle_hub/finetune/config.py rename to paddlehub/finetune/config.py index 7be21e63..9d6d6ea8 100644 --- a/paddle_hub/finetune/config.py +++ b/paddlehub/finetune/config.py @@ -12,12 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import time - -from .strategy import DefaultStrategy from datetime import datetime +import time -from paddle_hub.common.logger import logger +from paddlehub.finetune.strategy import DefaultStrategy +from paddlehub.common.logger import logger class RunConfig(object): diff --git a/paddle_hub/finetune/finetune.py b/paddlehub/finetune/finetune.py similarity index 97% rename from paddle_hub/finetune/finetune.py rename to paddlehub/finetune/finetune.py index 78b62915..b7240496 100644 --- a/paddle_hub/finetune/finetune.py +++ b/paddlehub/finetune/finetune.py @@ -22,12 +22,12 @@ import multiprocessing import paddle import paddle.fluid as fluid -import paddle_hub as hub -from visualdl import LogWriter -from paddle_hub.common.logger import logger -from paddle_hub.finetune.strategy import BERTFinetuneStrategy, DefaultStrategy -from paddle_hub.finetune.checkpoint import load_checkpoint, save_checkpoint +from paddlehub.common.logger import logger +from paddlehub.finetune.strategy import BERTFinetuneStrategy, DefaultStrategy +from paddlehub.finetune.checkpoint import load_checkpoint, save_checkpoint +from visualdl import LogWriter +import paddlehub as hub def _get_running_device_info(config): diff --git a/paddle_hub/finetune/network.py b/paddlehub/finetune/network.py similarity index 98% rename from paddle_hub/finetune/network.py rename to paddlehub/finetune/network.py index 48f5804b..dc3f5c5f 100644 --- a/paddle_hub/finetune/network.py +++ b/paddlehub/finetune/network.py @@ -14,12 +14,13 @@ import os import collections -import paddle.fluid as fluid import time -import numpy as np import multiprocessing -from .task import Task +import numpy as np +import paddle.fluid as fluid + +from paddlehub.finetune.task import Task __all__ = ['append_mlp_classifier'] diff --git a/paddle_hub/finetune/optimization.py b/paddlehub/finetune/optimization.py similarity index 100% rename from paddle_hub/finetune/optimization.py rename to paddlehub/finetune/optimization.py diff --git a/paddle_hub/finetune/strategy.py b/paddlehub/finetune/strategy.py similarity index 98% rename from paddle_hub/finetune/strategy.py rename to paddlehub/finetune/strategy.py index 9725ad5b..4be8c522 100644 --- a/paddle_hub/finetune/strategy.py +++ b/paddlehub/finetune/strategy.py @@ -16,7 +16,7 @@ import os import multiprocessing import paddle.fluid as fluid -from .optimization import adam_weight_decay_optimization +from paddlehub.finetune.optimization import adam_weight_decay_optimization def get_pretrained_parameter(main_program, start_program): diff --git a/paddle_hub/finetune/task.py b/paddlehub/finetune/task.py similarity index 99% rename from paddle_hub/finetune/task.py rename to paddlehub/finetune/task.py index 7904a0dd..24d27c52 100644 --- a/paddle_hub/finetune/task.py +++ b/paddlehub/finetune/task.py @@ -14,11 +14,12 @@ import os import collections -import paddle.fluid as fluid import time -import numpy as np import multiprocessing +import numpy as np +import paddle.fluid as fluid + class Task(object): def __init__(self, task_type, graph_var_dict, main_program, diff --git a/paddle_hub/io/__init__.py b/paddlehub/io/__init__.py similarity index 100% rename from paddle_hub/io/__init__.py rename to paddlehub/io/__init__.py diff --git a/paddle_hub/io/augmentation.py b/paddlehub/io/augmentation.py similarity index 99% rename from paddle_hub/io/augmentation.py rename to paddlehub/io/augmentation.py index e48b0ef6..ec5e8a6c 100644 --- a/paddle_hub/io/augmentation.py +++ b/paddlehub/io/augmentation.py @@ -15,10 +15,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function + from PIL import Image, ImageEnhance -from paddle_hub.common import utils import numpy as np +from paddlehub.common import utils + def _check_range_0_1(value): value = value if value <= 1 else 1 diff --git a/paddle_hub/io/postprocess.py b/paddlehub/io/postprocess.py similarity index 100% rename from paddle_hub/io/postprocess.py rename to paddlehub/io/postprocess.py diff --git a/paddle_hub/io/preprocess.py b/paddlehub/io/preprocess.py similarity index 100% rename from paddle_hub/io/preprocess.py rename to paddlehub/io/preprocess.py diff --git a/paddle_hub/io/reader.py b/paddlehub/io/reader.py similarity index 100% rename from paddle_hub/io/reader.py rename to paddlehub/io/reader.py diff --git a/paddle_hub/io/type.py b/paddlehub/io/type.py similarity index 95% rename from paddle_hub/io/type.py rename to paddlehub/io/type.py index e562b8cc..3fe43abe 100644 --- a/paddle_hub/io/type.py +++ b/paddlehub/io/type.py @@ -13,9 +13,11 @@ # limitations under the License. from enum import Enum + from PIL import Image -from paddle_hub.common.logger import logger -from paddle_hub.common import utils + +from paddlehub.common.logger import logger +from paddlehub.common import utils class DataType(Enum): diff --git a/paddle_hub/module/__init__.py b/paddlehub/module/__init__.py similarity index 100% rename from paddle_hub/module/__init__.py rename to paddlehub/module/__init__.py diff --git a/paddle_hub/module/base_processor.py b/paddlehub/module/base_processor.py similarity index 100% rename from paddle_hub/module/base_processor.py rename to paddlehub/module/base_processor.py diff --git a/paddle_hub/module/check_info.proto b/paddlehub/module/check_info.proto similarity index 100% rename from paddle_hub/module/check_info.proto rename to paddlehub/module/check_info.proto diff --git a/paddle_hub/module/check_info_pb2.py b/paddlehub/module/check_info_pb2.py similarity index 100% rename from paddle_hub/module/check_info_pb2.py rename to paddlehub/module/check_info_pb2.py diff --git a/paddle_hub/module/checker.py b/paddlehub/module/checker.py similarity index 97% rename from paddle_hub/module/checker.py rename to paddlehub/module/checker.py index fc1be77d..d8ecb4ff 100644 --- a/paddle_hub/module/checker.py +++ b/paddlehub/module/checker.py @@ -14,12 +14,15 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from paddle_hub.common.logger import logger -from paddle_hub.module import check_info_pb2 -from paddle_hub.version import hub_version, module_proto_version + import os + import paddle +from paddlehub.common.logger import logger +from paddlehub.module import check_info_pb2 +from paddlehub.version import hub_version, module_proto_version + # check info CHECK_INFO_PB_FILENAME = "check_info.pb" FILE_SEP = "/" diff --git a/paddle_hub/module/manager.py b/paddlehub/module/manager.py similarity index 95% rename from paddle_hub/module/manager.py rename to paddlehub/module/manager.py index 06069a5c..98bfa118 100644 --- a/paddle_hub/module/manager.py +++ b/paddlehub/module/manager.py @@ -19,10 +19,10 @@ from __future__ import print_function import os import shutil -from paddle_hub.common import utils -from paddle_hub.common.downloader import default_downloader -from paddle_hub.common.dir import MODULE_HOME -import paddle_hub as hub +from paddlehub.common import utils +from paddlehub.common.downloader import default_downloader +from paddlehub.common.dir import MODULE_HOME +import paddlehub as hub class LocalModuleManager: diff --git a/paddle_hub/module/module.py b/paddlehub/module/module.py similarity index 97% rename from paddle_hub/module/module.py rename to paddlehub/module/module.py index b412ad7d..85e3169f 100644 --- a/paddle_hub/module/module.py +++ b/paddlehub/module/module.py @@ -25,18 +25,18 @@ from shutil import copyfile import paddle import paddle.fluid as fluid -from paddle_hub.common import utils -from paddle_hub.common import paddle_helper -from paddle_hub.common.logger import logger -from paddle_hub.common.downloader import default_downloader -from paddle_hub.module import module_desc_pb2 -from paddle_hub.module import check_info_pb2 -from paddle_hub.module.signature import Signature, create_signature -from paddle_hub.module.checker import ModuleChecker -from paddle_hub.module.manager import default_module_manager -from paddle_hub.module.base_processor import BaseProcessor -from paddle_hub.io.reader import yaml_reader -from paddle_hub import version +from paddlehub.common import utils +from paddlehub.common import paddle_helper +from paddlehub.common.logger import logger +from paddlehub.common.downloader import default_downloader +from paddlehub.module import module_desc_pb2 +from paddlehub.module import check_info_pb2 +from paddlehub.module.signature import Signature, create_signature +from paddlehub.module.checker import ModuleChecker +from paddlehub.module.manager import default_module_manager +from paddlehub.module.base_processor import BaseProcessor +from paddlehub.io.reader import yaml_reader +from paddlehub import version __all__ = ['Module', 'create_module'] diff --git a/paddle_hub/module/module_desc.proto b/paddlehub/module/module_desc.proto similarity index 100% rename from paddle_hub/module/module_desc.proto rename to paddlehub/module/module_desc.proto diff --git a/paddle_hub/module/module_desc_pb2.py b/paddlehub/module/module_desc_pb2.py similarity index 100% rename from paddle_hub/module/module_desc_pb2.py rename to paddlehub/module/module_desc_pb2.py diff --git a/paddle_hub/module/signature.py b/paddlehub/module/signature.py similarity index 98% rename from paddle_hub/module/signature.py rename to paddlehub/module/signature.py index 163539a8..11d5bdea 100644 --- a/paddle_hub/module/signature.py +++ b/paddlehub/module/signature.py @@ -15,8 +15,10 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function + from paddle.fluid.framework import Variable -from paddle_hub.common.utils import to_list + +from paddlehub.common.utils import to_list class Signature: diff --git a/paddle_hub/reader/__init__.py b/paddlehub/reader/__init__.py similarity index 100% rename from paddle_hub/reader/__init__.py rename to paddlehub/reader/__init__.py diff --git a/paddle_hub/reader/batching.py b/paddlehub/reader/batching.py similarity index 100% rename from paddle_hub/reader/batching.py rename to paddlehub/reader/batching.py diff --git a/paddle_hub/reader/cv_reader.py b/paddlehub/reader/cv_reader.py similarity index 98% rename from paddle_hub/reader/cv_reader.py rename to paddlehub/reader/cv_reader.py index df75f0d3..0b8e37db 100644 --- a/paddle_hub/reader/cv_reader.py +++ b/paddlehub/reader/cv_reader.py @@ -20,7 +20,7 @@ import paddle import numpy as np from PIL import Image -import paddle_hub.io.augmentation as image_augmentation +import paddlehub.io.augmentation as image_augmentation color_mode_dict = { "RGB": [0, 1, 2], diff --git a/paddle_hub/reader/nlp_reader.py b/paddlehub/reader/nlp_reader.py similarity index 98% rename from paddle_hub/reader/nlp_reader.py rename to paddlehub/reader/nlp_reader.py index 4da1e7d7..5a37a799 100644 --- a/paddle_hub/reader/nlp_reader.py +++ b/paddlehub/reader/nlp_reader.py @@ -17,9 +17,9 @@ import types import csv import numpy as np -#from paddle_hub import dataset -from paddle_hub.reader import tokenization -from .batching import prepare_batch_data +#from paddlehub import dataset +from paddlehub.reader import tokenization +from paddlehub.reader.batching import prepare_batch_data class BERTTokenizeReader(object): diff --git a/paddle_hub/reader/tokenization.py b/paddlehub/reader/tokenization.py similarity index 100% rename from paddle_hub/reader/tokenization.py rename to paddlehub/reader/tokenization.py diff --git a/paddle_hub/version.py b/paddlehub/version.py similarity index 100% rename from paddle_hub/version.py rename to paddlehub/version.py diff --git a/scripts/gen_proto.sh b/scripts/gen_proto.sh index f5b614d7..042f5d34 100755 --- a/scripts/gen_proto.sh +++ b/scripts/gen_proto.sh @@ -1,4 +1,4 @@ #/bin/bash -protoc -I=../paddle_hub/module --python_out=../paddle_hub/module ../paddle_hub/module/module_desc.proto -protoc -I=../paddle_hub/module --python_out=../paddle_hub/module ../paddle_hub/module/check_info.proto -protoc -I=../paddle_hub/finetune --python_out=../paddle_hub/finetune ../paddle_hub/finetune/checkpoint.proto +protoc -I=../paddlehub/module --python_out=../paddlehub/module ../paddlehub/module/module_desc.proto +protoc -I=../paddlehub/module --python_out=../paddlehub/module ../paddlehub/module/check_info.proto +protoc -I=../paddlehub/finetune --python_out=../paddlehub/finetune ../paddlehub/finetune/checkpoint.proto diff --git a/setup.py b/setup.py index 559c496e..30e34cb3 100644 --- a/setup.py +++ b/setup.py @@ -18,14 +18,14 @@ from __future__ import print_function from setuptools import find_packages from setuptools import setup -from paddle_hub.version import hub_version +from paddlehub.version import hub_version REQUIRED_PACKAGES = [ 'numpy >= 1.12.0', 'six >= 1.10.0', 'protobuf >= 3.1.0', 'pyyaml', 'numpy' ] setup( - name='paddle_hub', + name='paddlehub', version=hub_version.replace('-', ''), description=('PaddleHub is a library to foster the publication, ' 'discovery, and consumption of reusable parts of machine ' @@ -56,5 +56,5 @@ setup( 'Topic :: Software Development :: Libraries :: Python Modules', ], license='Apache 2.0', - keywords=('paddlepaddle pretrained paddle-hub'), - entry_points={'console_scripts': ['hub=paddle_hub.commands.hub:main']}) + keywords=('paddlepaddle pretrained paddlehub'), + entry_points={'console_scripts': ['hub=paddlehub.commands.hub:main']}) diff --git a/tests/test_downloader.py b/tests/test_downloader.py index 2df20b37..cbd69a8b 100644 --- a/tests/test_downloader.py +++ b/tests/test_downloader.py @@ -13,7 +13,7 @@ # limitations under the License. import unittest -import paddle_hub as hub +import paddlehub as hub class TestDownloader(unittest.TestCase): diff --git a/tests/test_export_n_load_module.py b/tests/test_export_n_load_module.py index 4ddd5ae2..c2f7ef57 100644 --- a/tests/test_export_n_load_module.py +++ b/tests/test_export_n_load_module.py @@ -19,7 +19,7 @@ from __future__ import print_function import numpy as np import paddle.fluid as fluid import paddle -import paddle_hub as hub +import paddlehub as hub import unittest import os diff --git a/tests/test_module.py b/tests/test_module.py index 76791c92..6734a0b7 100644 --- a/tests/test_module.py +++ b/tests/test_module.py @@ -14,7 +14,7 @@ # limitations under the License. import unittest -import paddle_hub as hub +import paddlehub as hub import paddle.fluid as fluid diff --git a/tests/test_param_serialize.py b/tests/test_param_serialize.py index 813635a7..71ed83a3 100644 --- a/tests/test_param_serialize.py +++ b/tests/test_param_serialize.py @@ -13,11 +13,11 @@ # limitations under the License. import unittest -import paddle_hub as hub +import paddlehub as hub import paddle.fluid as fluid -from paddle_hub.paddle_helper import from_param_to_flexible_data, from_flexible_data_to_param -from paddle_hub import module_desc_pb2 -from paddle_hub.logger import logger +from paddlehub.paddle_helper import from_param_to_flexible_data, from_flexible_data_to_param +from paddlehub import module_desc_pb2 +from paddlehub.logger import logger class TestParamAttrSerializeAndDeSerialize(unittest.TestCase): diff --git a/tests/test_pyobj_serialize.py b/tests/test_pyobj_serialize.py index 7a9433ea..15ab9433 100644 --- a/tests/test_pyobj_serialize.py +++ b/tests/test_pyobj_serialize.py @@ -15,11 +15,11 @@ import sys import math import unittest -import paddle_hub as hub +import paddlehub as hub import paddle.fluid as fluid -from paddle_hub.utils import from_pyobj_to_flexible_data, from_flexible_data_to_pyobj, get_pykey -from paddle_hub import module_desc_pb2 -from paddle_hub.logger import logger +from paddlehub.utils import from_pyobj_to_flexible_data, from_flexible_data_to_pyobj, get_pykey +from paddlehub import module_desc_pb2 +from paddlehub.logger import logger def _compare_float(a, b): diff --git a/tests/test_signature.py b/tests/test_signature.py index fa049539..6ab78089 100644 --- a/tests/test_signature.py +++ b/tests/test_signature.py @@ -13,9 +13,9 @@ # limitations under the License. import unittest -import paddle_hub as hub +import paddlehub as hub import paddle.fluid as fluid -from paddle_hub import create_signature +from paddlehub import create_signature class TestSignature(unittest.TestCase): diff --git a/tests/test_train_w2v.py b/tests/test_train_w2v.py index 1e3459e0..436c2126 100644 --- a/tests/test_train_w2v.py +++ b/tests/test_train_w2v.py @@ -5,7 +5,7 @@ from __future__ import print_function import paddle import paddle.fluid as fluid -import paddle_hub as hub +import paddlehub as hub import unittest import os -- GitLab