Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
c915a749
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看板
提交
c915a749
编写于
4月 22, 2019
作者:
Z
zhangxuefei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix the bug that read_csv compatibility between py2 and py3
上级
2a8e0688
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
19 addition
and
5 deletion
+19
-5
demo/text-classification/run_classifier.sh
demo/text-classification/run_classifier.sh
+1
-1
paddlehub/__init__.py
paddlehub/__init__.py
+9
-0
paddlehub/dataset/chnsenticorp.py
paddlehub/dataset/chnsenticorp.py
+2
-1
paddlehub/dataset/lcqmc.py
paddlehub/dataset/lcqmc.py
+2
-1
paddlehub/dataset/msra_ner.py
paddlehub/dataset/msra_ner.py
+3
-1
paddlehub/dataset/nlpcc_dbqa.py
paddlehub/dataset/nlpcc_dbqa.py
+2
-1
未找到文件。
demo/text-classification/run_classifier.sh
浏览文件 @
c915a749
export
CUDA_VISIBLE_DEVICES
=
3
export
CUDA_VISIBLE_DEVICES
=
0
# User can select chnsenticorp, nlpcc_dbqa, lcqmc for different task
# User can select chnsenticorp, nlpcc_dbqa, lcqmc for different task
DATASET
=
"chnsenticorp"
DATASET
=
"chnsenticorp"
...
...
paddlehub/__init__.py
浏览文件 @
c915a749
...
@@ -11,6 +11,10 @@
...
@@ -11,6 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
#coding:utf-8
import
six
from
.
import
module
from
.
import
module
from
.
import
common
from
.
import
common
from
.
import
io
from
.
import
io
...
@@ -41,3 +45,8 @@ from .finetune.finetune import finetune_and_eval
...
@@ -41,3 +45,8 @@ from .finetune.finetune import finetune_and_eval
from
.finetune.config
import
RunConfig
from
.finetune.config
import
RunConfig
from
.finetune.strategy
import
AdamWeightDecayStrategy
from
.finetune.strategy
import
AdamWeightDecayStrategy
from
.finetune.strategy
import
DefaultStrategy
from
.finetune.strategy
import
DefaultStrategy
if
six
.
PY2
:
import
sys
reload
(
sys
)
sys
.
setdefaultencoding
(
"UTF-8"
)
\ No newline at end of file
paddlehub/dataset/chnsenticorp.py
浏览文件 @
c915a749
...
@@ -17,6 +17,7 @@ from __future__ import division
...
@@ -17,6 +17,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
from
collections
import
namedtuple
from
collections
import
namedtuple
import
codecs
import
os
import
os
import
csv
import
csv
...
@@ -79,7 +80,7 @@ class ChnSentiCorp(HubDataset):
...
@@ -79,7 +80,7 @@ class ChnSentiCorp(HubDataset):
def
_read_tsv
(
self
,
input_file
,
quotechar
=
None
):
def
_read_tsv
(
self
,
input_file
,
quotechar
=
None
):
"""Reads a tab separated value file."""
"""Reads a tab separated value file."""
with
open
(
input_file
,
"r
"
)
as
f
:
with
codecs
.
open
(
input_file
,
"r"
,
encoding
=
"UTF-8
"
)
as
f
:
reader
=
csv
.
reader
(
f
,
delimiter
=
"
\t
"
,
quotechar
=
quotechar
)
reader
=
csv
.
reader
(
f
,
delimiter
=
"
\t
"
,
quotechar
=
quotechar
)
examples
=
[]
examples
=
[]
seq_id
=
0
seq_id
=
0
...
...
paddlehub/dataset/lcqmc.py
浏览文件 @
c915a749
...
@@ -17,6 +17,7 @@ from __future__ import division
...
@@ -17,6 +17,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
from
collections
import
namedtuple
from
collections
import
namedtuple
import
codecs
import
os
import
os
import
csv
import
csv
...
@@ -75,7 +76,7 @@ class LCQMC(HubDataset):
...
@@ -75,7 +76,7 @@ class LCQMC(HubDataset):
def
_read_tsv
(
self
,
input_file
,
quotechar
=
None
):
def
_read_tsv
(
self
,
input_file
,
quotechar
=
None
):
"""Reads a tab separated value file."""
"""Reads a tab separated value file."""
with
open
(
input_file
,
"r
"
)
as
f
:
with
codecs
.
open
(
input_file
,
"r"
,
encoding
=
"UTF-8
"
)
as
f
:
reader
=
csv
.
reader
(
f
,
delimiter
=
"
\t
"
,
quotechar
=
quotechar
)
reader
=
csv
.
reader
(
f
,
delimiter
=
"
\t
"
,
quotechar
=
quotechar
)
examples
=
[]
examples
=
[]
seq_id
=
0
seq_id
=
0
...
...
paddlehub/dataset/msra_ner.py
浏览文件 @
c915a749
...
@@ -17,8 +17,10 @@ from __future__ import division
...
@@ -17,8 +17,10 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
import
os
import
os
import
codecs
import
csv
import
csv
import
json
import
json
import
six
from
collections
import
namedtuple
from
collections
import
namedtuple
from
paddlehub.dataset
import
InputExample
,
HubDataset
from
paddlehub.dataset
import
InputExample
,
HubDataset
...
@@ -85,7 +87,7 @@ class MSRA_NER(HubDataset):
...
@@ -85,7 +87,7 @@ class MSRA_NER(HubDataset):
def
_read_tsv
(
self
,
input_file
,
quotechar
=
None
):
def
_read_tsv
(
self
,
input_file
,
quotechar
=
None
):
"""Reads a tab separated value file."""
"""Reads a tab separated value file."""
with
open
(
input_file
,
"r
"
)
as
f
:
with
codecs
.
open
(
input_file
,
"r"
,
encoding
=
"UTF-8
"
)
as
f
:
reader
=
csv
.
reader
(
f
,
delimiter
=
"
\t
"
,
quotechar
=
quotechar
)
reader
=
csv
.
reader
(
f
,
delimiter
=
"
\t
"
,
quotechar
=
quotechar
)
examples
=
[]
examples
=
[]
seq_id
=
0
seq_id
=
0
...
...
paddlehub/dataset/nlpcc_dbqa.py
浏览文件 @
c915a749
...
@@ -17,6 +17,7 @@ from __future__ import division
...
@@ -17,6 +17,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
from
collections
import
namedtuple
from
collections
import
namedtuple
import
codecs
import
os
import
os
import
csv
import
csv
...
@@ -81,7 +82,7 @@ class NLPCC_DBQA(HubDataset):
...
@@ -81,7 +82,7 @@ class NLPCC_DBQA(HubDataset):
def
_read_tsv
(
self
,
input_file
,
quotechar
=
None
):
def
_read_tsv
(
self
,
input_file
,
quotechar
=
None
):
"""Reads a tab separated value file."""
"""Reads a tab separated value file."""
with
open
(
input_file
,
"r
"
)
as
f
:
with
codecs
.
open
(
input_file
,
"r"
,
encoding
=
"UTF-8
"
)
as
f
:
reader
=
csv
.
reader
(
f
,
delimiter
=
"
\t
"
,
quotechar
=
quotechar
)
reader
=
csv
.
reader
(
f
,
delimiter
=
"
\t
"
,
quotechar
=
quotechar
)
examples
=
[]
examples
=
[]
seq_id
=
0
seq_id
=
0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录