-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsetup.py
More file actions
39 lines (33 loc) · 1.47 KB
/
setup.py
File metadata and controls
39 lines (33 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import sys
import subprocess
from setuptools import setup
from setuptools.command.install import install
class CustomInstall(install):
def run(self):
install.run(self)
# Check the value of INSTALL_VLLM_ASCEND environment variable
install_vllm_ascend = os.environ.get('INSTALL_VLLM_ASCEND', '0') # Default to '0' if not set
if install_vllm_ascend not in ('0', '1'):
raise ValueError(
f"Invalid value for INSTALL_VLLM_ASCEND: {install_vllm_ascend!r}. "
"Expected '0' or '1'."
)
if install_vllm_ascend == '1':
print("Installing vLLM from source...")
env = os.environ.copy()
env['VLLM_TARGET_DEVICE'] = 'empty' # Optional: Define specific env variable if needed
# Install vLLM
subprocess.check_call([
sys.executable, '-m', 'pip', 'install',
'git+https://github.com/vllm-project/vllm.git@v0.7.3',
'--extra-index-url', 'https://download.pytorch.org/whl/cpu/'
], env=env)
print("Installing vLLM Ascend from source...")
# Install vLLM-Ascend
subprocess.check_call([
sys.executable, '-m', 'pip', 'install',
'git+https://github.com/vllm-project/vllm-ascend.git@v0.7.3.post1',
'--extra-index-url', 'https://download.pytorch.org/whl/cpu/'
])
setup(cmdclass={'install': CustomInstall})