Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
aad3a54e
Commit
aad3a54e
authored
Jun 18, 2019
by
thomwolf
Browse files
fix paths
parent
40dbda68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
examples/run_classifier.py
examples/run_classifier.py
+7
-9
No files found.
examples/run_classifier.py
View file @
aad3a54e
...
...
@@ -380,24 +380,22 @@ def main():
### Evaluation
if
args
.
do_eval
:
eval_examples
=
processor
.
get_dev_examples
(
args
.
data_dir
)
cached_
train
_features_file
=
os
.
path
.
join
(
args
.
data_dir
,
'dev_{0}_{1}_{2}'
.
format
(
cached_
eval
_features_file
=
os
.
path
.
join
(
args
.
data_dir
,
'dev_{0}_{1}_{2}'
.
format
(
list
(
filter
(
None
,
args
.
bert_model
.
split
(
'/'
))).
pop
(),
str
(
args
.
max_seq_length
),
str
(
task_name
)))
try
:
with
open
(
cached_
train
_features_file
,
"rb"
)
as
reader
:
with
open
(
cached_
eval
_features_file
,
"rb"
)
as
reader
:
train_features
=
pickle
.
load
(
reader
)
except
:
train
_features
=
convert_examples_to_features
(
train
_examples
,
label_list
,
args
.
max_seq_length
,
tokenizer
,
output_mode
)
eval
_features
=
convert_examples_to_features
(
eval
_examples
,
label_list
,
args
.
max_seq_length
,
tokenizer
,
output_mode
)
if
args
.
local_rank
==
-
1
or
torch
.
distributed
.
get_rank
()
==
0
:
logger
.
info
(
" Saving
train
features into cached file %s"
,
cached_
train
_features_file
)
with
open
(
cached_
train
_features_file
,
"wb"
)
as
writer
:
pickle
.
dump
(
train
_features
,
writer
)
logger
.
info
(
" Saving
eval
features into cached file %s"
,
cached_
eval
_features_file
)
with
open
(
cached_
eval
_features_file
,
"wb"
)
as
writer
:
pickle
.
dump
(
eval
_features
,
writer
)
eval_features
=
convert_examples_to_features
(
eval_examples
,
label_list
,
args
.
max_seq_length
,
tokenizer
,
output_mode
)
logger
.
info
(
"***** Running evaluation *****"
)
logger
.
info
(
" Num examples = %d"
,
len
(
eval_examples
))
logger
.
info
(
" Batch size = %d"
,
args
.
eval_batch_size
)
...
...
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