Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
bff1ab25
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
10 个月 前同步成功
通知
280
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,体验更适合开发者的 AI 搜索 >>
提交
bff1ab25
编写于
8月 05, 2019
作者:
K
kinghuin
提交者:
Steffy-zxf
8月 05, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix MNLI error (#103)
上级
4ab705ba
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
28 addition
and
6 deletion
+28
-6
paddlehub/dataset/glue.py
paddlehub/dataset/glue.py
+28
-6
未找到文件。
paddlehub/dataset/glue.py
浏览文件 @
bff1ab25
...
...
@@ -93,6 +93,9 @@ class GLUE(HubDataset):
def
get_test_examples
(
self
):
return
self
.
test_examples
def
get_predict_examples
(
self
):
return
self
.
predict_examples
def
get_labels
(
self
):
"""See base class."""
if
self
.
sub_dataset
in
[
'MRPC'
,
'QQP'
,
'SST-2'
,
'CoLA'
]:
...
...
@@ -157,9 +160,9 @@ class GLUE(HubDataset):
'MNLI'
,
]:
if
wo_label
:
label_index
,
text_a_index
,
text_b_index
=
[
None
,
-
1
,
-
2
]
label_index
,
text_a_index
,
text_b_index
=
[
None
,
-
2
,
-
1
]
else
:
label_index
,
text_a_index
,
text_b_index
=
[
-
1
,
-
4
,
-
5
]
label_index
,
text_a_index
,
text_b_index
=
[
-
1
,
-
4
,
-
3
]
elif
self
.
sub_dataset
in
[
'CoLA'
]:
if
wo_label
:
label_index
,
text_a_index
,
text_b_index
=
[
None
,
1
,
None
]
...
...
@@ -188,7 +191,26 @@ class GLUE(HubDataset):
if
__name__
==
"__main__"
:
ds
=
GLUE
(
sub_dataset
=
'SST-2'
)
for
e
in
ds
.
get_train_examples
()[:
3
]:
print
(
e
)
labels
=
set
()
ds
=
GLUE
(
sub_dataset
=
'CoLA'
)
total_len
=
0
max_len
=
0
total_num
=
over_num
=
0
overlen
=
[]
for
e
in
ds
.
get_predict_examples
():
length
=
len
(
e
.
text_a
.
split
())
+
len
(
e
.
text_b
.
split
())
if
e
.
text_b
else
len
(
e
.
text_a
.
split
())
total_len
+=
length
if
length
>
max_len
:
max_len
=
length
total_num
+=
1
if
length
>
128
:
over_num
+=
1
overstr
=
(
"
\n
text_a: "
+
e
.
text_a
+
"
\n
text_b:"
+
e
.
text_b
)
if
e
.
text_b
else
e
.
text_a
overlen
.
append
(
overstr
)
avg
=
total_len
/
total_num
for
o
in
overlen
[:
2
]:
print
(
"The data length>128:{}"
.
format
(
o
))
print
(
"The total number: {}
\n
The avrage length: {}
\n
the max length: {}
\n
the number of data length > 128: {}"
.
format
(
total_num
,
avg
,
max_len
,
over_num
))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录