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
aefc0c04
"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "dd9d483d03962fea127f59661f3ae6156e7a91d2"
Unverified
Commit
aefc0c04
authored
Jul 16, 2020
by
Patrick von Platen
Committed by
GitHub
Jul 16, 2020
Browse files
fix benchmark non standard model (#5801)
parent
8ce610bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
src/transformers/benchmark/benchmark.py
src/transformers/benchmark/benchmark.py
+2
-2
src/transformers/benchmark/benchmark_tf.py
src/transformers/benchmark/benchmark_tf.py
+2
-2
No files found.
src/transformers/benchmark/benchmark.py
View file @
aefc0c04
...
...
@@ -88,7 +88,7 @@ class PyTorchBenchmark(Benchmark):
if
self
.
args
.
torchscript
:
config
.
torchscript
=
True
has_model_class_in_config
=
hasattr
(
config
,
"architecture"
)
and
len
(
config
.
architectures
)
>
1
has_model_class_in_config
=
hasattr
(
config
,
"architecture
s
"
)
and
len
(
config
.
architectures
)
>
0
if
not
self
.
args
.
only_pretrain_model
and
has_model_class_in_config
:
try
:
model_class
=
config
.
architectures
[
0
]
...
...
@@ -138,7 +138,7 @@ class PyTorchBenchmark(Benchmark):
def
_prepare_train_func
(
self
,
model_name
:
str
,
batch_size
:
int
,
sequence_length
:
int
)
->
Callable
[[],
None
]:
config
=
self
.
config_dict
[
model_name
]
has_model_class_in_config
=
hasattr
(
config
,
"architecture"
)
and
len
(
config
.
architectures
)
>
1
has_model_class_in_config
=
hasattr
(
config
,
"architecture
s
"
)
and
len
(
config
.
architectures
)
>
0
if
not
self
.
args
.
only_pretrain_model
and
has_model_class_in_config
:
try
:
model_class
=
config
.
architectures
[
0
]
...
...
src/transformers/benchmark/benchmark_tf.py
View file @
aefc0c04
...
...
@@ -132,7 +132,7 @@ class TensorFlowBenchmark(Benchmark):
if
self
.
args
.
fp16
:
raise
NotImplementedError
(
"Mixed precision is currently not supported."
)
has_model_class_in_config
=
hasattr
(
config
,
"architecture"
)
and
len
(
config
.
architectures
)
>
1
has_model_class_in_config
=
hasattr
(
config
,
"architecture
s
"
)
and
len
(
config
.
architectures
)
>
0
if
not
self
.
args
.
only_pretrain_model
and
has_model_class_in_config
:
try
:
model_class
=
"TF"
+
config
.
architectures
[
0
]
# prepend 'TF' for tensorflow model
...
...
@@ -172,7 +172,7 @@ class TensorFlowBenchmark(Benchmark):
if
self
.
args
.
fp16
:
raise
NotImplementedError
(
"Mixed precision is currently not supported."
)
has_model_class_in_config
=
hasattr
(
config
,
"architecture"
)
and
len
(
config
.
architectures
)
>
1
has_model_class_in_config
=
hasattr
(
config
,
"architecture
s
"
)
and
len
(
config
.
architectures
)
>
0
if
not
self
.
args
.
only_pretrain_model
and
has_model_class_in_config
:
try
:
model_class
=
"TF"
+
config
.
architectures
[
0
]
# prepend 'TF' for tensorflow model
...
...
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