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
ColossalAI
Commits
8711310c
Unverified
Commit
8711310c
authored
Jan 05, 2023
by
Frank Lee
Committed by
GitHub
Jan 05, 2023
Browse files
[setup] remove torch dependency (#2333)
parent
89f26331
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
op_builder/builder.py
op_builder/builder.py
+6
-2
setup.py
setup.py
+3
-2
No files found.
op_builder/builder.py
View file @
8711310c
...
...
@@ -3,14 +3,18 @@ import re
from
pathlib
import
Path
from
typing
import
List
import
torch
def
get_cuda_cc_flag
()
->
List
:
"""get_cuda_cc_flag
cc flag for your GPU arch
"""
# only import torch when needed
# this is to avoid importing torch when building on a machine without torch pre-installed
# one case is to build wheel for pypi release
import
torch
cc_flag
=
[]
for
arch
in
torch
.
cuda
.
get_arch_list
():
res
=
re
.
search
(
r
'sm_(\d+)'
,
arch
)
...
...
setup.py
View file @
8711310c
...
...
@@ -15,8 +15,9 @@ try:
if
TORCH_MAJOR
<
1
or
(
TORCH_MAJOR
==
1
and
TORCH_MINOR
<
10
):
raise
RuntimeError
(
"Colossal-AI requires Pytorch 1.10 or newer.
\n
"
"The latest stable release can be obtained from https://pytorch.org/"
)
TORCH_AVAILABLE
=
True
except
ImportError
:
raise
ModuleNotFoundError
(
'torch is not found. You need to install PyTorch before installing Colossal-AI.'
)
TORCH_AVAILABLE
=
False
# ninja build does not work unless include_dirs are abs path
...
...
@@ -24,7 +25,7 @@ this_dir = os.path.dirname(os.path.abspath(__file__))
build_cuda_ext
=
True
ext_modules
=
[]
if
int
(
os
.
environ
.
get
(
'NO_CUDA_EXT'
,
'0'
))
==
1
:
if
int
(
os
.
environ
.
get
(
'NO_CUDA_EXT'
,
'0'
))
==
1
or
not
TORCH_AVAILABLE
:
build_cuda_ext
=
False
...
...
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