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
289cf4d2
Commit
289cf4d2
authored
Nov 05, 2019
by
VictorSanh
Committed by
Lysandre Debut
Nov 27, 2019
Browse files
change default for XNLI: dev --> test
parent
cb7b77a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
examples/run_xnli.py
examples/run_xnli.py
+3
-3
examples/utils_xnli.py
examples/utils_xnli.py
+3
-3
No files found.
examples/run_xnli.py
View file @
289cf4d2
...
...
@@ -270,7 +270,7 @@ def load_and_cache_examples(args, task, tokenizer, evaluate=False):
output_mode
=
output_modes
[
task
]
# Load data features from cache or dataset file
cached_features_file
=
os
.
path
.
join
(
args
.
data_dir
,
'cached_{}_{}_{}_{}_{}'
.
format
(
'
dev
'
if
evaluate
else
'train'
,
'
test
'
if
evaluate
else
'train'
,
list
(
filter
(
None
,
args
.
model_name_or_path
.
split
(
'/'
))).
pop
(),
str
(
args
.
max_seq_length
),
str
(
task
),
...
...
@@ -281,7 +281,7 @@ def load_and_cache_examples(args, task, tokenizer, evaluate=False):
else
:
logger
.
info
(
"Creating features from dataset file at %s"
,
args
.
data_dir
)
label_list
=
processor
.
get_labels
()
examples
=
processor
.
get_
dev
_examples
(
args
.
data_dir
)
if
evaluate
else
processor
.
get_train_examples
(
args
.
data_dir
)
examples
=
processor
.
get_
test
_examples
(
args
.
data_dir
)
if
evaluate
else
processor
.
get_train_examples
(
args
.
data_dir
)
features
=
convert_examples_to_features
(
examples
,
tokenizer
,
label_list
=
label_list
,
...
...
@@ -341,7 +341,7 @@ def main():
parser
.
add_argument
(
"--do_train"
,
action
=
'store_true'
,
help
=
"Whether to run training."
)
parser
.
add_argument
(
"--do_eval"
,
action
=
'store_true'
,
help
=
"Whether to run eval on the
dev
set."
)
help
=
"Whether to run eval on the
test
set."
)
parser
.
add_argument
(
"--evaluate_during_training"
,
action
=
'store_true'
,
help
=
"Rul evaluation during training at each logging step."
)
parser
.
add_argument
(
"--do_lower_case"
,
action
=
'store_true'
,
...
...
examples/utils_xnli.py
View file @
289cf4d2
...
...
@@ -50,9 +50,9 @@ class XnliProcessor(DataProcessor):
InputExample
(
guid
=
guid
,
text_a
=
text_a
,
text_b
=
text_b
,
label
=
label
))
return
examples
def
get_
dev
_examples
(
self
,
data_dir
):
def
get_
test
_examples
(
self
,
data_dir
):
"""See base class."""
lines
=
self
.
_read_tsv
(
os
.
path
.
join
(
data_dir
,
"XNLI-1.0/xnli.
dev
.tsv"
))
lines
=
self
.
_read_tsv
(
os
.
path
.
join
(
data_dir
,
"XNLI-1.0/xnli.
test
.tsv"
))
examples
=
[]
for
(
i
,
line
)
in
enumerate
(
lines
):
if
i
==
0
:
...
...
@@ -60,7 +60,7 @@ class XnliProcessor(DataProcessor):
language
=
line
[
0
]
if
language
!=
self
.
language
:
continue
guid
=
"%s-%s"
%
(
'
dev
'
,
i
)
guid
=
"%s-%s"
%
(
'
test
'
,
i
)
text_a
=
line
[
6
]
text_b
=
line
[
7
]
label
=
line
[
1
]
...
...
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