hook-bitsandbytes.py 1.1 KB

1234567891011121314151617181920212223
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2023 PyInstaller Development Team.
  3. #
  4. # This file is distributed under the terms of the GNU General Public
  5. # License (version 2.0 or later).
  6. #
  7. # The full license is available in LICENSE, distributed with
  8. # this software.
  9. #
  10. # SPDX-License-Identifier: GPL-2.0-or-later
  11. # ---------------------------------------------------
  12. from PyInstaller.utils.hooks import collect_dynamic_libs
  13. # bitsandbytes contains several extensions for CPU and different CUDA versions: libbitsandbytes_cpu.so,
  14. # libbitsandbytes_cuda110_nocublaslt.so, libbitsandbytes_cuda110.so, etc. At build-time, we could query the
  15. # `bitsandbytes.cextension.setup` and its `binary_name` attribute for the extension that is in use. However, if the
  16. # build system does not have CUDA available, this would automatically mean that we will not collect any of the CUDA
  17. # libs. So for now, we collect them all.
  18. binaries = collect_dynamic_libs("bitsandbytes")
  19. # bitsandbytes uses triton's JIT module, which requires access to source .py files.
  20. module_collection_mode = 'pyz+py'