A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 16, 15:45 UTC
[ci][build] fix vllm-flash-attn (#8699)
youkaichao committed
Sep 21, 2024 at 23:24 UTC
0e40ac9b7b5d953dfe38933bc7d2fb0a6c8da53c
3 files changed
+18
CMakeLists.txt
+3
@@ -382,6 +382,9 @@ endif()
382
# Set the parent build flag so that the vllm-flash-attn library does not redo compile flag and arch initialization.
383
set(VLLM_PARENT_BUILD ON)
384
385
+# Ensure the vllm/vllm_flash_attn directory exists before installation
386
+install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/vllm/vllm_flash_attn\")" COMPONENT vllm_flash_attn_c)
387
+
388
# Make sure vllm-flash-attn install rules are nested under vllm/
389
install(CODE "set(CMAKE_INSTALL_LOCAL_ONLY FALSE)" COMPONENT vllm_flash_attn_c)
390
install(CODE "set(OLD_CMAKE_INSTALL_PREFIX \"\${CMAKE_INSTALL_PREFIX}\")" COMPONENT vllm_flash_attn_c)
setup.py
+15
@@ -258,6 +258,21 @@ class cmake_build_ext(build_ext):
258
]
259
subprocess.check_call(install_args, cwd=self.build_temp)
260
261
+ def run(self):
262
+ # First, run the standard build_ext command to compile the extensions
263
+ super().run()
264
+
265
+ # copy vllm/vllm_flash_attn/*.py from self.build_lib to current
266
+ # directory so that they can be included in the editable build
267
+ import glob
268
+ files = glob.glob(
269
+ os.path.join(self.build_lib, "vllm", "vllm_flash_attn", "*.py"))
270
+ for file in files:
271
+ dst_file = os.path.join("vllm/vllm_flash_attn",
272
+ os.path.basename(file))
273
+ print(f"Copying {file} to {dst_file}")
274
+ self.copy_file(file, dst_file)
275
+
276
277
def _no_device() -> bool:
278
return VLLM_TARGET_DEVICE == "empty"