make vllm-ascend work well in developer mode (#4179)
### What this PR does / why we need it?
we often install vllm-ascend in developer mode, which has no _build_info
module. it will raise error in `utils.is_310p` and
`utils.sleep_model_enabled`, then we need to modify these two function.
### Does this PR introduce _any_ user-facing change?
not involved
### How was this patch tested?
not involved
- vLLM version: v0.11.0
- vLLM main:
2918c1b49c
Signed-off-by: Ronald1995 <ronaldautomobile@163.com>
This commit is contained in:
44
setup.py
44
setup.py
@@ -69,19 +69,7 @@ envs = load_module_from_path("envs",
|
|||||||
os.path.join(ROOT_DIR, "vllm_ascend", "envs.py"))
|
os.path.join(ROOT_DIR, "vllm_ascend", "envs.py"))
|
||||||
|
|
||||||
|
|
||||||
class CMakeExtension(Extension):
|
def gen_build_info():
|
||||||
|
|
||||||
def __init__(self,
|
|
||||||
name: str,
|
|
||||||
cmake_lists_dir: str = ".",
|
|
||||||
**kwargs) -> None:
|
|
||||||
super().__init__(name, sources=[], py_limited_api=False, **kwargs)
|
|
||||||
self.cmake_lists_dir = os.path.abspath(cmake_lists_dir)
|
|
||||||
|
|
||||||
|
|
||||||
class custom_build_info(build_py):
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
soc_version = envs.SOC_VERSION
|
soc_version = envs.SOC_VERSION
|
||||||
if not soc_version:
|
if not soc_version:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
@@ -96,10 +84,31 @@ class custom_build_info(build_py):
|
|||||||
with open(package_dir, "w+") as f:
|
with open(package_dir, "w+") as f:
|
||||||
f.write('# Auto-generated file\n')
|
f.write('# Auto-generated file\n')
|
||||||
f.write(f"__soc_version__ = '{soc_version}'\n")
|
f.write(f"__soc_version__ = '{soc_version}'\n")
|
||||||
f.write(
|
f.write(f"__sleep_mode_enabled__ = {envs.COMPILE_CUSTOM_KERNELS}\n")
|
||||||
f"__sleep_mode_enabled__ = {envs.COMPILE_CUSTOM_KERNELS}\n")
|
logging.info(f"Generated _build_info.py with SOC version: {soc_version}")
|
||||||
logging.info(
|
|
||||||
f"Generated _build_info.py with SOC version: {soc_version}")
|
|
||||||
|
class CMakeExtension(Extension):
|
||||||
|
|
||||||
|
def __init__(self,
|
||||||
|
name: str,
|
||||||
|
cmake_lists_dir: str = ".",
|
||||||
|
**kwargs) -> None:
|
||||||
|
super().__init__(name, sources=[], py_limited_api=False, **kwargs)
|
||||||
|
self.cmake_lists_dir = os.path.abspath(cmake_lists_dir)
|
||||||
|
|
||||||
|
|
||||||
|
class custom_develop(develop):
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
gen_build_info()
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
class custom_build_info(build_py):
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
gen_build_info()
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
@@ -352,6 +361,7 @@ def get_requirements() -> List[str]:
|
|||||||
|
|
||||||
|
|
||||||
cmdclass = {
|
cmdclass = {
|
||||||
|
"develop": custom_develop,
|
||||||
"build_py": custom_build_info,
|
"build_py": custom_build_info,
|
||||||
"build_ext": cmake_build_ext,
|
"build_ext": cmake_build_ext,
|
||||||
"install": custom_install
|
"install": custom_install
|
||||||
|
|||||||
Reference in New Issue
Block a user