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
7ef309ca
Unverified
Commit
7ef309ca
authored
Jun 21, 2021
by
Patrick von Platen
Committed by
GitHub
Jun 21, 2021
Browse files
[Flax] Add jax flax to env command (#12251)
* fix_torch_device_generate_test * remove @ * add commands for flax/jax
parent
e3cb7a0b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
src/transformers/commands/env.py
src/transformers/commands/env.py
+18
-1
No files found.
src/transformers/commands/env.py
View file @
7ef309ca
...
@@ -16,7 +16,7 @@ import platform
...
@@ -16,7 +16,7 @@ import platform
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
from
..
import
__version__
as
version
from
..
import
__version__
as
version
from
..file_utils
import
is_tf_available
,
is_torch_available
from
..file_utils
import
is_flax_available
,
is_tf_available
,
is_torch_available
from
.
import
BaseTransformersCLICommand
from
.
import
BaseTransformersCLICommand
...
@@ -52,12 +52,29 @@ class EnvironmentCommand(BaseTransformersCLICommand):
...
@@ -52,12 +52,29 @@ class EnvironmentCommand(BaseTransformersCLICommand):
# returns list of devices, convert to bool
# returns list of devices, convert to bool
tf_cuda_available
=
bool
(
tf
.
config
.
list_physical_devices
(
"GPU"
))
tf_cuda_available
=
bool
(
tf
.
config
.
list_physical_devices
(
"GPU"
))
flax_version
=
"not installed"
jax_version
=
"not installed"
jaxlib_version
=
"not installed"
jax_backend
=
"NA"
if
is_flax_available
():
import
flax
import
jax
import
jaxlib
flax_version
=
flax
.
__version__
jax_version
=
jax
.
__version__
jaxlib_version
=
jaxlib
.
__version__
jax_backend
=
jax
.
lib
.
xla_bridge
.
get_backend
().
platform
info
=
{
info
=
{
"`transformers` version"
:
version
,
"`transformers` version"
:
version
,
"Platform"
:
platform
.
platform
(),
"Platform"
:
platform
.
platform
(),
"Python version"
:
platform
.
python_version
(),
"Python version"
:
platform
.
python_version
(),
"PyTorch version (GPU?)"
:
f
"
{
pt_version
}
(
{
pt_cuda_available
}
)"
,
"PyTorch version (GPU?)"
:
f
"
{
pt_version
}
(
{
pt_cuda_available
}
)"
,
"Tensorflow version (GPU?)"
:
f
"
{
tf_version
}
(
{
tf_cuda_available
}
)"
,
"Tensorflow version (GPU?)"
:
f
"
{
tf_version
}
(
{
tf_cuda_available
}
)"
,
"Flax version (CPU?/GPU?/TPU?)"
:
f
"
{
flax_version
}
(
{
jax_backend
}
)"
,
"Jax version"
:
f
"
{
jax_version
}
"
,
"JaxLib version"
:
f
"
{
jaxlib_version
}
"
,
"Using GPU in script?"
:
"<fill in>"
,
"Using GPU in script?"
:
"<fill in>"
,
"Using distributed or parallel set-up in script?"
:
"<fill in>"
,
"Using distributed or parallel set-up in script?"
:
"<fill in>"
,
}
}
...
...
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