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
431ab19d
Unverified
Commit
431ab19d
authored
Aug 31, 2020
by
Sam Shleifer
Committed by
GitHub
Aug 31, 2020
Browse files
[fix] typo in available in helper function (#6859)
parent
367235ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
examples/test_examples.py
examples/test_examples.py
+4
-4
No files found.
examples/test_examples.py
View file @
431ab19d
...
@@ -53,7 +53,7 @@ def get_setup_file():
...
@@ -53,7 +53,7 @@ def get_setup_file():
return
args
.
f
return
args
.
f
def
is_cuda_and_apex_ava
l
iable
():
def
is_cuda_and_apex_avai
l
able
():
is_using_cuda
=
torch
.
cuda
.
is_available
()
and
torch_device
==
"cuda"
is_using_cuda
=
torch
.
cuda
.
is_available
()
and
torch_device
==
"cuda"
return
is_using_cuda
and
is_apex_available
()
return
is_using_cuda
and
is_apex_available
()
...
@@ -85,7 +85,7 @@ class ExamplesTests(TestCasePlus):
...
@@ -85,7 +85,7 @@ class ExamplesTests(TestCasePlus):
testargs
+=
"--output_dir "
+
output_dir
testargs
+=
"--output_dir "
+
output_dir
testargs
=
testargs
.
split
()
testargs
=
testargs
.
split
()
if
is_cuda_and_apex_ava
l
iable
():
if
is_cuda_and_apex_avai
l
able
():
testargs
.
append
(
"--fp16"
)
testargs
.
append
(
"--fp16"
)
with
patch
.
object
(
sys
,
"argv"
,
testargs
):
with
patch
.
object
(
sys
,
"argv"
,
testargs
):
...
@@ -115,7 +115,7 @@ class ExamplesTests(TestCasePlus):
...
@@ -115,7 +115,7 @@ class ExamplesTests(TestCasePlus):
"""
.
split
()
"""
.
split
()
if
torch
.
cuda
.
is_available
():
if
torch
.
cuda
.
is_available
():
testargs
+=
[
"--gpus=1"
]
testargs
+=
[
"--gpus=1"
]
if
is_cuda_and_apex_ava
l
iable
():
if
is_cuda_and_apex_avai
l
able
():
testargs
.
append
(
"--fp16"
)
testargs
.
append
(
"--fp16"
)
with
patch
.
object
(
sys
,
"argv"
,
testargs
):
with
patch
.
object
(
sys
,
"argv"
,
testargs
):
...
@@ -195,7 +195,7 @@ class ExamplesTests(TestCasePlus):
...
@@ -195,7 +195,7 @@ class ExamplesTests(TestCasePlus):
testargs
=
[
"run_generation.py"
,
"--prompt=Hello"
,
"--length=10"
,
"--seed=42"
]
testargs
=
[
"run_generation.py"
,
"--prompt=Hello"
,
"--length=10"
,
"--seed=42"
]
if
is_cuda_and_apex_ava
l
iable
():
if
is_cuda_and_apex_avai
l
able
():
testargs
.
append
(
"--fp16"
)
testargs
.
append
(
"--fp16"
)
model_type
,
model_name
=
(
model_type
,
model_name
=
(
...
...
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