Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
0d309ce3
Unverified
Commit
0d309ce3
authored
Oct 07, 2021
by
Максим Заякин
Committed by
GitHub
Oct 07, 2021
Browse files
Raise exceptions instead of asserts (#13907)
parent
5be59a36
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
utils/download_glue_data.py
utils/download_glue_data.py
+6
-3
No files found.
utils/download_glue_data.py
View file @
0d309ce3
...
...
@@ -68,8 +68,10 @@ def format_mrpc(data_dir, path_to_data):
mrpc_test_file
=
os
.
path
.
join
(
mrpc_dir
,
"msr_paraphrase_test.txt"
)
urllib
.
request
.
urlretrieve
(
MRPC_TRAIN
,
mrpc_train_file
)
urllib
.
request
.
urlretrieve
(
MRPC_TEST
,
mrpc_test_file
)
assert
os
.
path
.
isfile
(
mrpc_train_file
),
"Train data not found at %s"
%
mrpc_train_file
assert
os
.
path
.
isfile
(
mrpc_test_file
),
"Test data not found at %s"
%
mrpc_test_file
if
not
os
.
path
.
isfile
(
mrpc_train_file
):
raise
ValueError
(
f
"Train data not found at
{
mrpc_train_file
}
"
)
if
not
os
.
path
.
isfile
(
mrpc_test_file
):
raise
ValueError
(
f
"Test data not found at
{
mrpc_test_file
}
"
)
urllib
.
request
.
urlretrieve
(
TASK2PATH
[
"MRPC"
],
os
.
path
.
join
(
mrpc_dir
,
"dev_ids.tsv"
))
dev_ids
=
[]
...
...
@@ -118,7 +120,8 @@ def get_tasks(task_names):
else
:
tasks
=
[]
for
task_name
in
task_names
:
assert
task_name
in
TASKS
,
"Task %s not found!"
%
task_name
if
task_name
not
in
TASKS
:
raise
ValueError
(
f
"Task
{
task_name
}
not found!"
)
tasks
.
append
(
task_name
)
return
tasks
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment