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
fc624716
Commit
fc624716
authored
Dec 19, 2019
by
Morgan Funtowicz
Browse files
Renaming framework env variables flags from NO_ to USE_
parent
f516cf39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
transformers/file_utils.py
transformers/file_utils.py
+6
-4
No files found.
transformers/file_utils.py
View file @
fc624716
...
@@ -27,8 +27,9 @@ from contextlib import contextmanager
...
@@ -27,8 +27,9 @@ from contextlib import contextmanager
logger
=
logging
.
getLogger
(
__name__
)
# pylint: disable=invalid-name
logger
=
logging
.
getLogger
(
__name__
)
# pylint: disable=invalid-name
try
:
try
:
if
'NO_TF'
in
os
.
environ
and
os
.
environ
[
'NO_TF'
].
upper
()
in
(
'1'
,
'ON'
):
os
.
environ
.
setdefault
(
'USE_TF'
,
'YES'
)
logger
.
info
(
"Found NO_TF, disabling TensorFlow"
)
if
os
.
environ
[
'USE_TF'
].
upper
()
in
(
'1'
,
'ON'
,
'YES'
):
logger
.
info
(
"USE_TF override through env variable, disabling Tensorflow"
)
_tf_available
=
False
_tf_available
=
False
else
:
else
:
import
tensorflow
as
tf
import
tensorflow
as
tf
...
@@ -39,8 +40,9 @@ except (ImportError, AssertionError):
...
@@ -39,8 +40,9 @@ except (ImportError, AssertionError):
_tf_available
=
False
# pylint: disable=invalid-name
_tf_available
=
False
# pylint: disable=invalid-name
try
:
try
:
if
'NO_TORCH'
in
os
.
environ
and
os
.
environ
[
'NO_TORCH'
].
upper
()
in
(
'1'
,
'ON'
):
os
.
environ
.
setdefault
(
'USE_TORCH'
,
'YES'
)
logger
.
info
(
"Found NO_TORCH, disabling PyTorch"
)
if
os
.
environ
[
'USE_TORCH'
].
upper
()
in
(
'1'
,
'ON'
,
'YES'
):
logger
.
info
(
"USE_TORCH override through env variable, disabling PyTorch"
)
_torch_available
=
False
_torch_available
=
False
else
:
else
:
import
torch
import
torch
...
...
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