Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
8f8ce71a
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
大约 1 年 前同步成功
通知
281
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8f8ce71a
编写于
1月 04, 2019
作者:
W
wuzewu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/PaddlePaddle/PaddleHub
上级
6f7dd36e
1606dbbd
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
188 addition
and
2 deletion
+188
-2
Senta/nets.py
Senta/nets.py
+1
-0
Senta/sentiment_classify.py
Senta/sentiment_classify.py
+0
-1
paddle_hub/module.py
paddle_hub/module.py
+2
-0
paddle_hub/module_desc_pb2.py
paddle_hub/module_desc_pb2.py
+185
-0
tests/test_export_n_load_module.py
tests/test_export_n_load_module.py
+0
-1
未找到文件。
Senta/nets.py
浏览文件 @
8f8ce71a
...
...
@@ -4,6 +4,7 @@ import numpy as np
import
paddle.fluid
as
fluid
import
paddle
import
paddle_hub
as
hub
def
bow_net
(
data
,
...
...
Senta/sentiment_classify.py
浏览文件 @
8f8ce71a
...
...
@@ -189,7 +189,6 @@ def retrain_net(train_reader,
hid_dim2
=
96
class_dim
=
2
# module_link = "https://paddlehub.cdn.bcebos.com/senta/bow_module_3.tar.gz"
module_link
=
"./models/bow_net/"
module
=
hub
.
Module
(
module_link
)
...
...
paddle_hub/module.py
浏览文件 @
8f8ce71a
...
...
@@ -49,11 +49,13 @@ class Module(object):
# if it's remote url link, then download and uncompress it
self
.
module_name
,
self
.
module_dir
=
download_and_uncompress
(
module_url
)
#TODO(ZeyuChen): check url link is valid url
elif
module_dir
is
not
None
:
# otherwise it's local path, no need to deal with it
self
.
module_dir
=
module_dir
# use the path name as module name by default
self
.
module_name
=
module_dir
.
split
(
"/"
)[
-
1
]
#TODO(ZeyuChen) add more check about loading module from local path
# load paddle inference model
place
=
fluid
.
CPUPlace
()
...
...
paddle_hub/module_desc_pb2.py
0 → 100644
浏览文件 @
8f8ce71a
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: module_desc.proto
import
sys
_b
=
sys
.
version_info
[
0
]
<
3
and
(
lambda
x
:
x
)
or
(
lambda
x
:
x
.
encode
(
'latin1'
))
from
google.protobuf
import
descriptor
as
_descriptor
from
google.protobuf
import
message
as
_message
from
google.protobuf
import
reflection
as
_reflection
from
google.protobuf
import
symbol_database
as
_symbol_database
# @@protoc_insertion_point(imports)
_sym_db
=
_symbol_database
.
Default
()
DESCRIPTOR
=
_descriptor
.
FileDescriptor
(
name
=
'module_desc.proto'
,
package
=
'paddle_hub'
,
syntax
=
'proto3'
,
serialized_options
=
_b
(
'H
\003
'
),
serialized_pb
=
_b
(
'
\n\x11
module_desc.proto
\x12\n
paddle_hub
\"\x19\n\t
InputDesc
\x12\x0c\n\x04
name
\x18\x01
\x01
(
\t\"\x1a\n\n
OutputDesc
\x12\x0c\n\x04
name
\x18\x01
\x01
(
\t\"\xb3\x01\n\n
ModuleDesc
\x12\x0c\n\x04
name
\x18\x01
\x01
(
\t\x12
)
\n\n
input_desc
\x18\x02
\x03
(
\x0b\x32\x15
.paddle_hub.InputDesc
\x12
+
\n\x0b
output_desc
\x18\x03
\x03
(
\x0b\x32\x16
.paddle_hub.OutputDesc
\x12\x11\n\t
signature
\x18\x04
\x01
(
\t\x12\x14\n\x0c
return_numpy
\x18\x05
\x01
(
\x08\x12\x16\n\x0e\x63
ontain_assets
\x18\x06
\x01
(
\x08\x42\x02
H
\x03\x62\x06
proto3'
)
)
_INPUTDESC
=
_descriptor
.
Descriptor
(
name
=
'InputDesc'
,
full_name
=
'paddle_hub.InputDesc'
,
filename
=
None
,
file
=
DESCRIPTOR
,
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'name'
,
full_name
=
'paddle_hub.InputDesc.name'
,
index
=
0
,
number
=
1
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
).
decode
(
'utf-8'
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
],
extensions
=
[
],
nested_types
=
[],
enum_types
=
[
],
serialized_options
=
None
,
is_extendable
=
False
,
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
33
,
serialized_end
=
58
,
)
_OUTPUTDESC
=
_descriptor
.
Descriptor
(
name
=
'OutputDesc'
,
full_name
=
'paddle_hub.OutputDesc'
,
filename
=
None
,
file
=
DESCRIPTOR
,
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'name'
,
full_name
=
'paddle_hub.OutputDesc.name'
,
index
=
0
,
number
=
1
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
).
decode
(
'utf-8'
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
],
extensions
=
[
],
nested_types
=
[],
enum_types
=
[
],
serialized_options
=
None
,
is_extendable
=
False
,
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
60
,
serialized_end
=
86
,
)
_MODULEDESC
=
_descriptor
.
Descriptor
(
name
=
'ModuleDesc'
,
full_name
=
'paddle_hub.ModuleDesc'
,
filename
=
None
,
file
=
DESCRIPTOR
,
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'name'
,
full_name
=
'paddle_hub.ModuleDesc.name'
,
index
=
0
,
number
=
1
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
).
decode
(
'utf-8'
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
_descriptor
.
FieldDescriptor
(
name
=
'input_desc'
,
full_name
=
'paddle_hub.ModuleDesc.input_desc'
,
index
=
1
,
number
=
2
,
type
=
11
,
cpp_type
=
10
,
label
=
3
,
has_default_value
=
False
,
default_value
=
[],
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
_descriptor
.
FieldDescriptor
(
name
=
'output_desc'
,
full_name
=
'paddle_hub.ModuleDesc.output_desc'
,
index
=
2
,
number
=
3
,
type
=
11
,
cpp_type
=
10
,
label
=
3
,
has_default_value
=
False
,
default_value
=
[],
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
_descriptor
.
FieldDescriptor
(
name
=
'signature'
,
full_name
=
'paddle_hub.ModuleDesc.signature'
,
index
=
3
,
number
=
4
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
).
decode
(
'utf-8'
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
_descriptor
.
FieldDescriptor
(
name
=
'return_numpy'
,
full_name
=
'paddle_hub.ModuleDesc.return_numpy'
,
index
=
4
,
number
=
5
,
type
=
8
,
cpp_type
=
7
,
label
=
1
,
has_default_value
=
False
,
default_value
=
False
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
_descriptor
.
FieldDescriptor
(
name
=
'contain_assets'
,
full_name
=
'paddle_hub.ModuleDesc.contain_assets'
,
index
=
5
,
number
=
6
,
type
=
8
,
cpp_type
=
7
,
label
=
1
,
has_default_value
=
False
,
default_value
=
False
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
],
extensions
=
[
],
nested_types
=
[],
enum_types
=
[
],
serialized_options
=
None
,
is_extendable
=
False
,
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
89
,
serialized_end
=
268
,
)
_MODULEDESC
.
fields_by_name
[
'input_desc'
].
message_type
=
_INPUTDESC
_MODULEDESC
.
fields_by_name
[
'output_desc'
].
message_type
=
_OUTPUTDESC
DESCRIPTOR
.
message_types_by_name
[
'InputDesc'
]
=
_INPUTDESC
DESCRIPTOR
.
message_types_by_name
[
'OutputDesc'
]
=
_OUTPUTDESC
DESCRIPTOR
.
message_types_by_name
[
'ModuleDesc'
]
=
_MODULEDESC
_sym_db
.
RegisterFileDescriptor
(
DESCRIPTOR
)
InputDesc
=
_reflection
.
GeneratedProtocolMessageType
(
'InputDesc'
,
(
_message
.
Message
,),
dict
(
DESCRIPTOR
=
_INPUTDESC
,
__module__
=
'module_desc_pb2'
# @@protoc_insertion_point(class_scope:paddle_hub.InputDesc)
))
_sym_db
.
RegisterMessage
(
InputDesc
)
OutputDesc
=
_reflection
.
GeneratedProtocolMessageType
(
'OutputDesc'
,
(
_message
.
Message
,),
dict
(
DESCRIPTOR
=
_OUTPUTDESC
,
__module__
=
'module_desc_pb2'
# @@protoc_insertion_point(class_scope:paddle_hub.OutputDesc)
))
_sym_db
.
RegisterMessage
(
OutputDesc
)
ModuleDesc
=
_reflection
.
GeneratedProtocolMessageType
(
'ModuleDesc'
,
(
_message
.
Message
,),
dict
(
DESCRIPTOR
=
_MODULEDESC
,
__module__
=
'module_desc_pb2'
# @@protoc_insertion_point(class_scope:paddle_hub.ModuleDesc)
))
_sym_db
.
RegisterMessage
(
ModuleDesc
)
DESCRIPTOR
.
_options
=
None
# @@protoc_insertion_point(module_scope)
tests/test_export_n_load_module.py
浏览文件 @
8f8ce71a
...
...
@@ -58,7 +58,6 @@ def module_fn(trainable=False):
name
=
"words"
,
shape
=
[
1
],
lod_level
=
1
,
dtype
=
"int64"
)
# create embedding
# emb_name = "{}:embedding".format(module_scope)
emb_name
=
"embedding"
emb_param_attr
=
fluid
.
ParamAttr
(
name
=
emb_name
,
trainable
=
trainable
)
word_emb
=
fluid
.
layers
.
embedding
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录