Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
f0bba396
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
1 年多 前同步成功
通知
283
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看板
提交
f0bba396
编写于
4月 10, 2019
作者:
Z
Zeyu Chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
correct log info grammar
上级
dae2ef9b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
26 addition
and
20 deletion
+26
-20
demo/ernie-classification/run_question_matching.sh
demo/ernie-classification/run_question_matching.sh
+2
-2
paddlehub/dataset/__init__.py
paddlehub/dataset/__init__.py
+4
-0
paddlehub/dataset/lcqmc.py
paddlehub/dataset/lcqmc.py
+2
-2
paddlehub/module/checker.py
paddlehub/module/checker.py
+3
-3
paddlehub/module/manager.py
paddlehub/module/manager.py
+3
-2
paddlehub/module/module.py
paddlehub/module/module.py
+8
-5
paddlehub/module/signature.py
paddlehub/module/signature.py
+2
-4
paddlehub/version.py
paddlehub/version.py
+2
-2
未找到文件。
demo/ernie-classification/run_question_matching.sh
浏览文件 @
f0bba396
export
CUDA_VISIBLE_DEVICES
=
0
CKPT_DIR
=
"./ckpt_question_matching"
python
-u
sentiment_cls
.py
\
python
-u
question_matching
.py
\
--batch_size
32
\
--weight_decay
0.0
0
\
--weight_decay
0.0
\
--checkpoint_dir
$CKPT_DIR
\
--num_epoch
3
\
--max_seq_len
128
\
...
...
paddlehub/dataset/__init__.py
浏览文件 @
f0bba396
...
...
@@ -12,9 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# NLP Dataset
from
.dataset
import
InputExample
,
HubDataset
from
.chnsenticorp
import
ChnSentiCorp
from
.msra_ner
import
MSRA_NER
from
.nlpcc_dbqa
import
NLPCC_DBQA
from
.lcqmc
import
LCQMC
# CV Dataset
from
.dogcat
import
DogCatDataset
as
DogCat
from
.flowers
import
FlowersDataset
as
Flowers
paddlehub/dataset/lcqmc.py
浏览文件 @
f0bba396
...
...
@@ -24,7 +24,7 @@ from paddlehub.common.logger import logger
DATA_URL
=
"https://paddlehub-dataset.bj.bcebos.com/lcqmc.tar.gz"
class
NLPCC_DBQA
(
HubDataset
):
class
LCQMC
(
HubDataset
):
def
__init__
(
self
):
self
.
dataset_dir
=
os
.
path
.
join
(
DATA_HOME
,
"lcqmc"
)
if
not
os
.
path
.
exists
(
self
.
dataset_dir
):
...
...
@@ -79,6 +79,6 @@ class NLPCC_DBQA(HubDataset):
if
__name__
==
"__main__"
:
ds
=
NLPCC_DBQA
()
ds
=
LCQMC
()
for
e
in
ds
.
get_train_examples
():
print
(
"{}
\t
{}
\t
{}
\t
{}"
.
format
(
e
.
guid
,
e
.
text_a
,
e
.
text_b
,
e
.
label
))
paddlehub/module/checker.py
浏览文件 @
f0bba396
...
...
@@ -154,16 +154,16 @@ class ModuleChecker:
if
not
os
.
path
.
exists
(
file_path
):
if
file_info
.
is_need
:
logger
.
error
(
"
module lack of necessary
file [%s]"
%
file_path
)
"
Module incompleted! Missing
file [%s]"
%
file_path
)
return
False
else
:
if
file_type
==
check_info_pb2
.
FILE
:
if
not
os
.
path
.
isfile
(
file_path
):
logger
.
error
(
"
f
ile type error %s"
%
file_path
)
logger
.
error
(
"
F
ile type error %s"
%
file_path
)
return
False
if
file_type
==
check_info_pb2
.
DIR
:
if
not
os
.
path
.
isdir
(
file_path
):
logger
.
error
(
"
f
ile type error %s"
%
file_path
)
logger
.
error
(
"
F
ile type error %s"
%
file_path
)
return
False
return
True
paddlehub/module/manager.py
浏览文件 @
f0bba396
...
...
@@ -61,13 +61,14 @@ class LocalModuleManager:
self
.
all_modules
(
update
=
True
)
if
module_name
in
self
.
modules_dict
:
module_dir
=
self
.
modules_dict
[
module_name
]
tips
=
"module %s already install in %s"
%
(
module_name
,
module_dir
)
tips
=
"Module %s already installed in %s"
%
(
module_name
,
module_dir
)
return
True
,
tips
,
module_dir
url
=
hub
.
default_hub_server
.
get_module_url
(
module_name
,
version
=
module_version
)
#TODO(wuzewu): add compatibility check
if
not
url
:
tips
=
"
can't fou
nd module %s"
%
module_name
tips
=
"
Can't fi
nd module %s"
%
module_name
if
module_version
:
tips
+=
" with version %s"
%
module_version
return
False
,
tips
,
None
...
...
paddlehub/module/module.py
浏览文件 @
f0bba396
...
...
@@ -128,7 +128,7 @@ class Module(object):
self
.
_generate_module_info
(
module_info
)
self
.
_init_with_signature
(
signatures
=
signatures
)
else
:
raise
"Error! HubModule can't init with nothing"
raise
ValueError
(
"Error! Module initialized parameter is empty"
)
def
_init_with_name
(
self
,
name
):
logger
.
info
(
"Try installing module %s"
%
name
)
...
...
@@ -191,7 +191,8 @@ class Module(object):
def
_init_with_module_file
(
self
,
module_dir
):
checker
=
ModuleChecker
(
module_dir
)
if
not
checker
.
check
():
logger
.
error
(
"Module init failed on {}"
.
format
(
module_dir
))
logger
.
error
(
"Module initialization failed on {}"
.
format
(
module_dir
))
exit
(
1
)
self
.
helper
=
ModuleHelper
(
module_dir
)
...
...
@@ -223,7 +224,9 @@ class Module(object):
self
.
program
=
signatures
[
0
].
inputs
[
0
].
block
.
program
for
sign
in
signatures
:
if
sign
.
name
in
self
.
signatures
:
raise
"Error! signature array contains repeat signatrue %s"
%
sign
raise
ValueError
(
"Error! Signature array contains duplicated signatrues %s"
%
sign
)
if
self
.
default_signature
is
None
and
sign
.
for_predict
:
self
.
default_signature
=
sign
self
.
signatures
[
sign
.
name
]
=
sign
...
...
@@ -265,7 +268,7 @@ class Module(object):
self
.
module_info
=
{}
else
:
if
not
utils
.
is_yaml_file
(
module_info
):
logger
.
critical
(
"
module info file should in
yaml format"
)
logger
.
critical
(
"
Module info file should be
yaml format"
)
exit
(
1
)
self
.
module_info
=
yaml_parser
.
parse
(
module_info
)
self
.
author
=
self
.
module_info
.
get
(
'author'
,
'UNKNOWN'
)
...
...
@@ -532,7 +535,7 @@ class Module(object):
return
self
.
get_name_prefix
()
+
var_name
def
_check_signatures
(
self
):
assert
self
.
signatures
,
"
s
ignature array should not be None"
assert
self
.
signatures
,
"
S
ignature array should not be None"
for
key
,
sign
in
self
.
signatures
.
items
():
assert
isinstance
(
sign
,
...
...
paddlehub/module/signature.py
浏览文件 @
f0bba396
...
...
@@ -47,13 +47,11 @@ class Signature:
self
.
name
=
name
for
item
in
inputs
:
assert
isinstance
(
item
,
Variable
),
"the item of inputs list shoule be paddle Variable"
item
,
Variable
),
"the item of inputs list shoule be Variable"
for
item
in
outputs
:
assert
isinstance
(
item
,
Variable
),
"the item of outputs list shoule be paddle Variable"
item
,
Variable
),
"the item of outputs list shoule be Variable"
self
.
inputs
=
inputs
self
.
outputs
=
outputs
...
...
paddlehub/version.py
浏览文件 @
f0bba396
...
...
@@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
""" PaddleHub version string """
hub_version
=
"0.
3.1
.alpha"
module_proto_version
=
"
0.1
.0"
hub_version
=
"0.
4.0
.alpha"
module_proto_version
=
"
1.0
.0"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录