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
OpenDAS
apex
Commits
799785ab
Commit
799785ab
authored
Jun 25, 2021
by
Jithun Nair
Browse files
Make torch version check numeric
parent
107f1ff5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
setup.py
setup.py
+5
-5
No files found.
setup.py
View file @
799785ab
...
...
@@ -20,9 +20,13 @@ def get_cuda_bare_metal_version(cuda_dir):
return
raw_output
,
bare_metal_major
,
bare_metal_minor
print
(
"
\n\n
torch.__version__ = {}
\n\n
"
.
format
(
torch
.
__version__
))
TORCH_MAJOR
=
int
(
torch
.
__version__
.
split
(
'.'
)[
0
])
TORCH_MINOR
=
int
(
torch
.
__version__
.
split
(
'.'
)[
1
])
def
check_if_rocm_pytorch
():
is_rocm_pytorch
=
False
if
torch
.
__version__
>=
'1.5'
:
if
TORCH_MAJOR
>
1
or
(
TORCH_MAJOR
==
1
and
TORCH_MINOR
>=
5
)
:
from
torch.utils.cpp_extension
import
ROCM_HOME
is_rocm_pytorch
=
True
if
((
torch
.
version
.
hip
is
not
None
)
and
(
ROCM_HOME
is
not
None
))
else
False
...
...
@@ -53,10 +57,6 @@ elif not torch.cuda.is_available() and IS_ROCM_PYTORCH:
'By default, Apex will cross-compile for the same gfx targets
\n
'
'used by default in ROCm PyTorch
\n
'
)
print
(
"
\n\n
torch.__version__ = {}
\n\n
"
.
format
(
torch
.
__version__
))
TORCH_MAJOR
=
int
(
torch
.
__version__
.
split
(
'.'
)[
0
])
TORCH_MINOR
=
int
(
torch
.
__version__
.
split
(
'.'
)[
1
])
if
TORCH_MAJOR
==
0
and
TORCH_MINOR
<
4
:
raise
RuntimeError
(
"Apex requires Pytorch 0.4 or newer.
\n
"
+
"The latest stable release can be obtained from https://pytorch.org/"
)
...
...
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