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
25296b12
Unverified
Commit
25296b12
authored
May 06, 2020
by
Simone Primarosa
Committed by
GitHub
May 06, 2020
Browse files
Fix overwrite_cache behaviour for pytorch lightning examples (#4093)
parent
9972562d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
examples/glue/run_pl_glue.py
examples/glue/run_pl_glue.py
+4
-1
examples/ner/run_pl_ner.py
examples/ner/run_pl_ner.py
+4
-1
No files found.
examples/glue/run_pl_glue.py
View file @
25296b12
...
@@ -52,7 +52,10 @@ class GLUETransformer(BaseTransformer):
...
@@ -52,7 +52,10 @@ class GLUETransformer(BaseTransformer):
for
mode
in
[
"train"
,
"dev"
]:
for
mode
in
[
"train"
,
"dev"
]:
cached_features_file
=
self
.
_feature_file
(
mode
)
cached_features_file
=
self
.
_feature_file
(
mode
)
if
not
os
.
path
.
exists
(
cached_features_file
)
and
not
args
.
overwrite_cache
:
if
os
.
path
.
exists
(
cached_features_file
)
and
not
args
.
overwrite_cache
:
logger
.
info
(
"Loading features from cached file %s"
,
cached_features_file
)
features
=
torch
.
load
(
cached_features_file
)
else
:
logger
.
info
(
"Creating features from dataset file at %s"
,
args
.
data_dir
)
logger
.
info
(
"Creating features from dataset file at %s"
,
args
.
data_dir
)
examples
=
(
examples
=
(
processor
.
get_dev_examples
(
args
.
data_dir
)
processor
.
get_dev_examples
(
args
.
data_dir
)
...
...
examples/ner/run_pl_ner.py
View file @
25296b12
...
@@ -50,7 +50,10 @@ class NERTransformer(BaseTransformer):
...
@@ -50,7 +50,10 @@ class NERTransformer(BaseTransformer):
args
=
self
.
hparams
args
=
self
.
hparams
for
mode
in
[
"train"
,
"dev"
,
"test"
]:
for
mode
in
[
"train"
,
"dev"
,
"test"
]:
cached_features_file
=
self
.
_feature_file
(
mode
)
cached_features_file
=
self
.
_feature_file
(
mode
)
if
not
os
.
path
.
exists
(
cached_features_file
):
if
os
.
path
.
exists
(
cached_features_file
)
and
not
args
.
overwrite_cache
:
logger
.
info
(
"Loading features from cached file %s"
,
cached_features_file
)
features
=
torch
.
load
(
cached_features_file
)
else
:
logger
.
info
(
"Creating features from dataset file at %s"
,
args
.
data_dir
)
logger
.
info
(
"Creating features from dataset file at %s"
,
args
.
data_dir
)
examples
=
read_examples_from_file
(
args
.
data_dir
,
mode
)
examples
=
read_examples_from_file
(
args
.
data_dir
,
mode
)
features
=
convert_examples_to_features
(
features
=
convert_examples_to_features
(
...
...
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