Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
37ed4ebb
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
大约 1 年 前同步成功
通知
282
Star
12117
Fork
2091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
200
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleHub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
200
Issue
200
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
37ed4ebb
编写于
4月 03, 2019
作者:
W
wuzewu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename paddle_hub to paddlehub
上级
f9faa71c
变更
88
显示空白变更内容
内联
并排
Showing
88 changed file
with
202 addition
and
169 deletion
+202
-169
README.md
README.md
+1
-1
demo/ernie-classification/finetune_with_hub.py
demo/ernie-classification/finetune_with_hub.py
+1
-1
demo/image-classification/create_module.py
demo/image-classification/create_module.py
+4
-1
demo/image-classification/infer.sh
demo/image-classification/infer.sh
+1
-1
demo/image-classification/processor.py
demo/image-classification/processor.py
+5
-3
demo/image-classification/retrain.py
demo/image-classification/retrain.py
+3
-2
demo/lac/create_module.py
demo/lac/create_module.py
+1
-1
demo/lac/infer.sh
demo/lac/infer.sh
+1
-1
demo/lac/infer_by_code.py
demo/lac/infer_by_code.py
+1
-1
demo/lac/processor.py
demo/lac/processor.py
+2
-2
demo/senta/create_module.py
demo/senta/create_module.py
+1
-1
demo/senta/infer.sh
demo/senta/infer.sh
+1
-1
demo/senta/infer_by_code.py
demo/senta/infer_by_code.py
+1
-1
demo/senta/processor.py
demo/senta/processor.py
+1
-1
demo/ssd/create_module.py
demo/ssd/create_module.py
+1
-1
demo/ssd/infer.sh
demo/ssd/infer.sh
+1
-1
demo/ssd/infer_by_code.py
demo/ssd/infer_by_code.py
+1
-1
demo/ssd/processor.py
demo/ssd/processor.py
+2
-2
docs/transfer_learning_turtorial.md
docs/transfer_learning_turtorial.md
+1
-1
paddlehub/__init__.py
paddlehub/__init__.py
+0
-0
paddlehub/commands/__init__.py
paddlehub/commands/__init__.py
+0
-0
paddlehub/commands/base_command.py
paddlehub/commands/base_command.py
+3
-1
paddlehub/commands/download.py
paddlehub/commands/download.py
+7
-5
paddlehub/commands/help.py
paddlehub/commands/help.py
+2
-1
paddlehub/commands/hub.py
paddlehub/commands/hub.py
+9
-7
paddlehub/commands/install.py
paddlehub/commands/install.py
+4
-4
paddlehub/commands/list.py
paddlehub/commands/list.py
+5
-5
paddlehub/commands/run.py
paddlehub/commands/run.py
+8
-8
paddlehub/commands/search.py
paddlehub/commands/search.py
+8
-5
paddlehub/commands/show.py
paddlehub/commands/show.py
+5
-5
paddlehub/commands/uninstall.py
paddlehub/commands/uninstall.py
+4
-4
paddlehub/commands/version.py
paddlehub/commands/version.py
+3
-3
paddlehub/common/__init__.py
paddlehub/common/__init__.py
+0
-0
paddlehub/common/arg_helper.py
paddlehub/common/arg_helper.py
+3
-1
paddlehub/common/dir.py
paddlehub/common/dir.py
+0
-0
paddlehub/common/downloader.py
paddlehub/common/downloader.py
+3
-3
paddlehub/common/hub_server.py
paddlehub/common/hub_server.py
+6
-4
paddlehub/common/logger.py
paddlehub/common/logger.py
+1
-0
paddlehub/common/paddle_helper.py
paddlehub/common/paddle_helper.py
+5
-3
paddlehub/common/utils.py
paddlehub/common/utils.py
+7
-6
paddlehub/dataset/__init__.py
paddlehub/dataset/__init__.py
+0
-0
paddlehub/dataset/base_cv_dataset.py
paddlehub/dataset/base_cv_dataset.py
+2
-2
paddlehub/dataset/chnsenticorp.py
paddlehub/dataset/chnsenticorp.py
+5
-6
paddlehub/dataset/dataset.py
paddlehub/dataset/dataset.py
+0
-0
paddlehub/dataset/dogcat.py
paddlehub/dataset/dogcat.py
+2
-2
paddlehub/dataset/flowers.py
paddlehub/dataset/flowers.py
+2
-2
paddlehub/dataset/msra_ner.py
paddlehub/dataset/msra_ner.py
+3
-3
paddlehub/finetune/__init__.py
paddlehub/finetune/__init__.py
+0
-0
paddlehub/finetune/checkpoint.proto
paddlehub/finetune/checkpoint.proto
+0
-0
paddlehub/finetune/checkpoint.py
paddlehub/finetune/checkpoint.py
+2
-2
paddlehub/finetune/checkpoint_pb2.py
paddlehub/finetune/checkpoint_pb2.py
+0
-0
paddlehub/finetune/config.py
paddlehub/finetune/config.py
+3
-4
paddlehub/finetune/finetune.py
paddlehub/finetune/finetune.py
+5
-5
paddlehub/finetune/network.py
paddlehub/finetune/network.py
+4
-3
paddlehub/finetune/optimization.py
paddlehub/finetune/optimization.py
+0
-0
paddlehub/finetune/strategy.py
paddlehub/finetune/strategy.py
+1
-1
paddlehub/finetune/task.py
paddlehub/finetune/task.py
+3
-2
paddlehub/io/__init__.py
paddlehub/io/__init__.py
+0
-0
paddlehub/io/augmentation.py
paddlehub/io/augmentation.py
+3
-1
paddlehub/io/postprocess.py
paddlehub/io/postprocess.py
+0
-0
paddlehub/io/preprocess.py
paddlehub/io/preprocess.py
+0
-0
paddlehub/io/reader.py
paddlehub/io/reader.py
+0
-0
paddlehub/io/type.py
paddlehub/io/type.py
+4
-2
paddlehub/module/__init__.py
paddlehub/module/__init__.py
+0
-0
paddlehub/module/base_processor.py
paddlehub/module/base_processor.py
+0
-0
paddlehub/module/check_info.proto
paddlehub/module/check_info.proto
+0
-0
paddlehub/module/check_info_pb2.py
paddlehub/module/check_info_pb2.py
+0
-0
paddlehub/module/checker.py
paddlehub/module/checker.py
+6
-3
paddlehub/module/manager.py
paddlehub/module/manager.py
+4
-4
paddlehub/module/module.py
paddlehub/module/module.py
+12
-12
paddlehub/module/module_desc.proto
paddlehub/module/module_desc.proto
+0
-0
paddlehub/module/module_desc_pb2.py
paddlehub/module/module_desc_pb2.py
+0
-0
paddlehub/module/signature.py
paddlehub/module/signature.py
+3
-1
paddlehub/reader/__init__.py
paddlehub/reader/__init__.py
+0
-0
paddlehub/reader/batching.py
paddlehub/reader/batching.py
+0
-0
paddlehub/reader/cv_reader.py
paddlehub/reader/cv_reader.py
+1
-1
paddlehub/reader/nlp_reader.py
paddlehub/reader/nlp_reader.py
+3
-3
paddlehub/reader/tokenization.py
paddlehub/reader/tokenization.py
+0
-0
paddlehub/version.py
paddlehub/version.py
+0
-0
scripts/gen_proto.sh
scripts/gen_proto.sh
+3
-3
setup.py
setup.py
+4
-4
tests/test_downloader.py
tests/test_downloader.py
+1
-1
tests/test_export_n_load_module.py
tests/test_export_n_load_module.py
+1
-1
tests/test_module.py
tests/test_module.py
+1
-1
tests/test_param_serialize.py
tests/test_param_serialize.py
+4
-4
tests/test_pyobj_serialize.py
tests/test_pyobj_serialize.py
+4
-4
tests/test_signature.py
tests/test_signature.py
+2
-2
tests/test_train_w2v.py
tests/test_train_w2v.py
+1
-1
未找到文件。
README.md
浏览文件 @
37ed4ebb
...
...
@@ -16,7 +16,7 @@ PaddleHub旨在为PaddlePaddle提供一个简明易用的预训练模型管理
# 安装
paddle hub直接通过pip进行安装(python3以上),使用如下命令来安装paddle hub
```
pip install paddle
_
hub
pip install paddlehub
```
# 快速体验
通过下面的命令,来体验下paddle hub的魅力
...
...
demo/ernie-classification/finetune_with_hub.py
浏览文件 @
37ed4ebb
...
...
@@ -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__
)
...
...
demo/image-classification/create_module.py
浏览文件 @
37ed4ebb
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__
)
...
...
demo/image-classification/infer.sh
浏览文件 @
37ed4ebb
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
demo/image-classification/processor.py
浏览文件 @
37ed4ebb
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
))
...
...
demo/image-classification/retrain.py
浏览文件 @
37ed4ebb
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
()
...
...
demo/lac/create_module.py
浏览文件 @
37ed4ebb
...
...
@@ -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
...
...
demo/lac/infer.sh
浏览文件 @
37ed4ebb
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
demo/lac/infer_by_code.py
浏览文件 @
37ed4ebb
import
os
import
paddle
_
hub
as
hub
import
paddlehub
as
hub
def
infer_with_input_text
():
...
...
demo/lac/processor.py
浏览文件 @
37ed4ebb
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
):
...
...
demo/senta/create_module.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
demo/senta/infer.sh
浏览文件 @
37ed4ebb
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
demo/senta/infer_by_code.py
浏览文件 @
37ed4ebb
import
os
import
paddle
_
hub
as
hub
import
paddlehub
as
hub
def
infer_with_input_text
():
...
...
demo/senta/processor.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
demo/ssd/create_module.py
浏览文件 @
37ed4ebb
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
...
...
demo/ssd/infer.sh
浏览文件 @
37ed4ebb
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
demo/ssd/infer_by_code.py
浏览文件 @
37ed4ebb
import
os
import
paddle
_
hub
as
hub
import
paddlehub
as
hub
def
infer_with_input_text
():
...
...
demo/ssd/processor.py
浏览文件 @
37ed4ebb
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
...
...
docs/transfer_learning_turtorial.md
浏览文件 @
37ed4ebb
...
...
@@ -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
...
...
paddle
_
hub/__init__.py
→
paddlehub/__init__.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/commands/__init__.py
→
paddlehub/commands/__init__.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/commands/base_command.py
→
paddlehub/commands/base_command.py
浏览文件 @
37ed4ebb
...
...
@@ -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"
...
...
paddle
_
hub/commands/download.py
→
paddlehub/commands/download.py
浏览文件 @
37ed4ebb
...
...
@@ -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"
...
...
paddle
_
hub/commands/help.py
→
paddlehub/commands/help.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
paddle
_
hub/commands/hub.py
→
paddlehub/commands/hub.py
浏览文件 @
37ed4ebb
...
...
@@ -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"
...
...
paddle
_
hub/commands/install.py
→
paddlehub/commands/install.py
浏览文件 @
37ed4ebb
...
...
@@ -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
paddle
hub.common
import
utils
from
paddle
hub.module.manager
import
default_module_manager
from
paddle
hub.commands.base_command
import
BaseCommand
,
ENTRY
class
InstallCommand
(
BaseCommand
):
...
...
paddle
_
hub/commands/list.py
→
paddlehub/commands/list.py
浏览文件 @
37ed4ebb
...
...
@@ -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_download
er
from
paddle
_hub.module.manager
import
default_module_manager
from
paddlehub.common.logger
import
logger
from
paddle
hub.common
import
utils
from
paddle
hub.common.downloader
import
default_downloader
from
paddle
hub.module.manager
import
default_module_manag
er
from
paddle
hub.commands.base_command
import
BaseCommand
class
ListCommand
(
BaseCommand
):
...
...
paddle
_
hub/commands/run.py
→
paddlehub/commands/run.py
浏览文件 @
37ed4ebb
...
...
@@ -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"
...
...
paddle
_
hub/commands/search.py
→
paddlehub/commands/search.py
浏览文件 @
37ed4ebb
...
...
@@ -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
)
...
...
paddle
_
hub/commands/show.py
→
paddlehub/commands/show.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
paddle
_
hub/commands/uninstall.py
→
paddlehub/commands/uninstall.py
浏览文件 @
37ed4ebb
...
...
@@ -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
paddle
hub.common
import
utils
from
paddle
hub.module.manager
import
default_module_manager
from
paddle
hub.commands.base_command
import
BaseCommand
,
ENTRY
class
UninstallCommand
(
BaseCommand
):
...
...
paddle
_
hub/commands/version.py
→
paddlehub/commands/version.py
浏览文件 @
37ed4ebb
...
...
@@ -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
paddle
hub
import
version
from
paddle
hub.commands.base_command
import
BaseCommand
class
VersionCommand
(
BaseCommand
):
...
...
paddle
_
hub/common/__init__.py
→
paddlehub/common/__init__.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/common/arg_helper.py
→
paddlehub/common/arg_helper.py
浏览文件 @
37ed4ebb
...
...
@@ -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
...
...
paddle
_
hub/common/dir.py
→
paddlehub/common/dir.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/common/downloader.py
→
paddlehub/common/downloader.py
浏览文件 @
37ed4ebb
...
...
@@ -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
...
...
paddle
_
hub/common/hub_server.py
→
paddlehub/common/hub_server.py
浏览文件 @
37ed4ebb
...
...
@@ -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"
...
...
paddle
_
hub/common/logger.py
→
paddlehub/common/logger.py
浏览文件 @
37ed4ebb
...
...
@@ -15,6 +15,7 @@
from
__future__
import
print_function
from
__future__
import
division
from
__future__
import
print_function
import
logging
import
math
...
...
paddle
_
hub/common/paddle_helper.py
→
paddlehub/common/paddle_helper.py
浏览文件 @
37ed4ebb
...
...
@@ -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
(
...
...
paddle
_
hub/common/utils.py
→
paddlehub/common/utils.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
paddle
_
hub/dataset/__init__.py
→
paddlehub/dataset/__init__.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/dataset/base_cv_dataset.py
→
paddlehub/dataset/base_cv_dataset.py
浏览文件 @
37ed4ebb
...
...
@@ -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
:
...
...
paddle
_
hub/dataset/chnsenticorp.py
→
paddlehub/dataset/chnsenticorp.py
浏览文件 @
37ed4ebb
...
...
@@ -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"
...
...
paddle
_
hub/dataset/dataset.py
→
paddlehub/dataset/dataset.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/dataset/dogcat.py
→
paddlehub/dataset/dogcat.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
paddle
_
hub/dataset/flowers.py
→
paddlehub/dataset/flowers.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
paddle
_
hub/dataset/msra_ner.py
→
paddlehub/dataset/msra_ner.py
浏览文件 @
37ed4ebb
...
...
@@ -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"
...
...
paddle
_
hub/finetune/__init__.py
→
paddlehub/finetune/__init__.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/finetune/checkpoint.proto
→
paddlehub/finetune/checkpoint.proto
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/finetune/checkpoint.py
→
paddlehub/finetune/checkpoint.py
浏览文件 @
37ed4ebb
...
...
@@ -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"
...
...
paddle
_
hub/finetune/checkpoint_pb2.py
→
paddlehub/finetune/checkpoint_pb2.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/finetune/config.py
→
paddlehub/finetune/config.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
paddle
_
hub/finetune/finetune.py
→
paddlehub/finetune/finetune.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
paddle
_
hub/finetune/network.py
→
paddlehub/finetune/network.py
浏览文件 @
37ed4ebb
...
...
@@ -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'
]
...
...
paddle
_
hub/finetune/optimization.py
→
paddlehub/finetune/optimization.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/finetune/strategy.py
→
paddlehub/finetune/strategy.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
paddle
_
hub/finetune/task.py
→
paddlehub/finetune/task.py
浏览文件 @
37ed4ebb
...
...
@@ -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
,
...
...
paddle
_
hub/io/__init__.py
→
paddlehub/io/__init__.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/io/augmentation.py
→
paddlehub/io/augmentation.py
浏览文件 @
37ed4ebb
...
...
@@ -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
...
...
paddle
_
hub/io/postprocess.py
→
paddlehub/io/postprocess.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/io/preprocess.py
→
paddlehub/io/preprocess.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/io/reader.py
→
paddlehub/io/reader.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/io/type.py
→
paddlehub/io/type.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
paddle
_
hub/module/__init__.py
→
paddlehub/module/__init__.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/module/base_processor.py
→
paddlehub/module/base_processor.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/module/check_info.proto
→
paddlehub/module/check_info.proto
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/module/check_info_pb2.py
→
paddlehub/module/check_info_pb2.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/module/checker.py
→
paddlehub/module/checker.py
浏览文件 @
37ed4ebb
...
...
@@ -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
=
"/"
...
...
paddle
_
hub/module/manager.py
→
paddlehub/module/manager.py
浏览文件 @
37ed4ebb
...
...
@@ -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
:
...
...
paddle
_
hub/module/module.py
→
paddlehub/module/module.py
浏览文件 @
37ed4ebb
...
...
@@ -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'
]
...
...
paddle
_
hub/module/module_desc.proto
→
paddlehub/module/module_desc.proto
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/module/module_desc_pb2.py
→
paddlehub/module/module_desc_pb2.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/module/signature.py
→
paddlehub/module/signature.py
浏览文件 @
37ed4ebb
...
...
@@ -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
:
...
...
paddle
_
hub/reader/__init__.py
→
paddlehub/reader/__init__.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/reader/batching.py
→
paddlehub/reader/batching.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/reader/cv_reader.py
→
paddlehub/reader/cv_reader.py
浏览文件 @
37ed4ebb
...
...
@@ -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
],
...
...
paddle
_
hub/reader/nlp_reader.py
→
paddlehub/reader/nlp_reader.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
paddle
_
hub/reader/tokenization.py
→
paddlehub/reader/tokenization.py
浏览文件 @
37ed4ebb
文件已移动
paddle
_
hub/version.py
→
paddlehub/version.py
浏览文件 @
37ed4ebb
文件已移动
scripts/gen_proto.sh
浏览文件 @
37ed4ebb
#/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
=
../paddle
hub/module
--python_out
=
../paddlehub/module ../paddle
hub/module/module_desc.proto
protoc
-I
=
../paddle
hub/module
--python_out
=
../paddlehub/module ../paddle
hub/module/check_info.proto
protoc
-I
=
../paddle
hub/finetune
--python_out
=
../paddlehub/finetune ../paddle
hub/finetune/checkpoint.proto
setup.py
浏览文件 @
37ed4ebb
...
...
@@ -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'
]})
tests/test_downloader.py
浏览文件 @
37ed4ebb
...
...
@@ -13,7 +13,7 @@
# limitations under the License.
import
unittest
import
paddle
_
hub
as
hub
import
paddlehub
as
hub
class
TestDownloader
(
unittest
.
TestCase
):
...
...
tests/test_export_n_load_module.py
浏览文件 @
37ed4ebb
...
...
@@ -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
...
...
tests/test_module.py
浏览文件 @
37ed4ebb
...
...
@@ -14,7 +14,7 @@
# limitations under the License.
import
unittest
import
paddle
_
hub
as
hub
import
paddlehub
as
hub
import
paddle.fluid
as
fluid
...
...
tests/test_param_serialize.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
tests/test_pyobj_serialize.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
tests/test_signature.py
浏览文件 @
37ed4ebb
...
...
@@ -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
):
...
...
tests/test_train_w2v.py
浏览文件 @
37ed4ebb
...
...
@@ -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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录