|
36 | 36 | is_dep_available, |
37 | 37 | is_paddle2onnx_plugin_available, |
38 | 38 | ) |
39 | | -from .utils.env import get_gpu_compute_capability, get_paddle_cuda_version |
| 39 | +from .utils.env import ( |
| 40 | + get_gpu_compute_capability, |
| 41 | + get_paddle_cuda_version, |
| 42 | + is_cuda_available, |
| 43 | +) |
40 | 44 | from .utils.install import install_packages, uninstall_packages |
41 | 45 | from .utils.interactive_get_pipeline import interactive_get_pipeline |
42 | 46 | from .utils.pipeline_arguments import PIPELINE_ARGUMENTS |
@@ -365,21 +369,24 @@ def _install_genai_deps(plugin_types): |
365 | 369 |
|
366 | 370 | for plugin_type in plugin_types: |
367 | 371 | if "vllm" in plugin_type or "sglang" in plugin_type: |
368 | | - try: |
369 | | - install_packages(["wheel"], constraints="required") |
370 | | - cap = get_gpu_compute_capability() |
371 | | - if cap >= (12, 0): |
372 | | - install_packages( |
373 | | - ["xformers", "flash-attn == 2.8.3"], constraints="required" |
374 | | - ) |
375 | | - else: |
376 | | - install_packages( |
377 | | - ["xformers", "flash-attn == 2.8.2"], constraints="required" |
378 | | - ) |
379 | | - except Exception: |
380 | | - logging.error("Installation failed", exc_info=True) |
381 | | - sys.exit(1) |
382 | | - break |
| 372 | + install_packages(["xformers"], constraints="required") |
| 373 | + if is_cuda_available(): |
| 374 | + try: |
| 375 | + install_packages(["wheel"], constraints="required") |
| 376 | + cap = get_gpu_compute_capability() |
| 377 | + assert cap is not None |
| 378 | + if cap >= (12, 0): |
| 379 | + install_packages( |
| 380 | + ["flash-attn == 2.8.3"], constraints="required" |
| 381 | + ) |
| 382 | + else: |
| 383 | + install_packages( |
| 384 | + ["flash-attn == 2.8.2"], constraints="required" |
| 385 | + ) |
| 386 | + except Exception: |
| 387 | + logging.error("Installation failed", exc_info=True) |
| 388 | + sys.exit(1) |
| 389 | + break |
383 | 390 |
|
384 | 391 | logging.info( |
385 | 392 | "Successfully installed the generative AI plugin" |
|
0 commit comments