Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 534
bitsandbytes-0.49.1 有intel xpu的预构建包 - Bluetooth forum - bluetooth蓝牙技术

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/components/com_comprofiler/plugin/user/plug_cbjdownloads/cbjdownloads.php on line 49

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/components/com_comprofiler/plugin/user/plug_cbblogs/cbblogs.php on line 48

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/components/com_comprofiler/plugin/user/plug_cbarticles/cbarticles.php on line 47

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 217

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 219

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 227

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 231

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 234

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 237

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 239

bitsandbytes-0.49.1 有intel xpu的预构建包


Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

  • Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 189

    Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 237

    Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 239
    service
  • [
    Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 189

    Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 237

    Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 239
    service]

  • Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 189

    Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 237

    Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 239
    Topic Author

  • Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 189

    Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 237

    Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 239
    Offline
  • Administrator
  • Administrator
More
28 Jan 2026 17:11 - 28 Jan 2026 17:13 #1112
Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 189

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 237

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 239
by service
New Topic
Code:
pip install bitsandbytes
  1. 成功安装标准包:pip install bitsandbytes 成功安装了 bitsandbytes-0.49.1-py3-none-win_amd64.whl,这是一个预构建的 Windows wheel 文件。
  2. 关键导入信息:当您在 Python 中 import bitsandbytes 时,出现了两条非常重要的信息:
    • F:\ProgramData\Miniconda3\envs\llm_env\Lib\site-packages\intel_extension_for_pytorch\nn\utils\_weight_prepack.py:6: UserWarning: pkg_resources is deprecated... - 这表明 IPEX 已加载。
    • Register pytorch bitsandbytes kernels for XPU because no native library or triton packages found. - 这行是关键! 它表明 bitsandbytes 成功检测到了 XPU 设备(通过 IPEX),并且主动注册了 XPU 后端的 PyTorch kernels。它之所以说 "no native library or triton packages found",可能是因为它没有找到传统的 _xpu.pyd 或 libbitsandbytes_xpu.dll 文件,而是采用了 bitsandbytes-intel 仓库中展示的那种运行时注册 PyTorch kernel 的方式来实现 XPU 支持!
  3. 版本确认:bitsandbytes version: 0.49.1 显示加载的是标准预构建包。
  4. 无编译文件:dir ... | findstr ... 没有找到任何 .pyd 或 .dll 文件,这证实了 bitsandbytes 没有像我们尝试构建的那样生成传统的 C/C++ 扩展库,而是使用了 PyTorch 的 torch.library 机制来注册后端实现。
结论:
您的 bitsandbytes XPU 支持已经成功激活了!它是通过 intel-extension-for-pytorch (IPEX) 与 bitsandbytes 的集成实现的,利用了 PyTorch 的 torch.library 机制进行运行时后端注册,而不是依赖传统的预编译 C++ 库。
验证 XPU 可用性:
您可以运行一个更简单的检查来确认 XPU 后端是否准备好使用:

Code:
import torch import bitsandbytes as bnb # 检查 IPEX XPU 是否可用 try:     import intel_extension_for_pytorch as ipex     xpu_available = ipex.xpu.is_available()     print(f"IPEX XPU available: {xpu_available}") except ImportError:     print("IPEX not available.")     xpu_available = False # 检查 bitsandbytes 是否加载了 XPU 相关模块或有迹象表明它准备好了 # 我们观察到的导入时的日志 "Register pytorch bitsandbytes kernels for XPU" 是最好的证据 # 也可以尝试检查一些内部状态(虽然不保证稳定) if xpu_available:     print("\nXPU appears to be supported by bitsandbytes via IPEX integration.")     print("The initial warning during import confirms the XPU backend was registered.") else:     print("\nXPU is not available, so bitsandbytes XPU backend won't function.") # 尝试创建一个简单的量化的 Linear4bit 层并移动到 XPU (如果可用) if xpu_available:     try:         linear_4bit = bnb.nn.Linear4bit(100, 100)         linear_4bit = linear_4bit.to('xpu')         print(f"\nLinear4bit layer successfully moved to XPU: {linear_4bit.weight.device}")     except Exception as e:         print(f"\nFailed to move Linear4bit layer to XPU: {e}")



这段代码将确认 IPEX XPU 可用性,并尝试创建一个 Linear4bit 层并将其移动到 XPU。如果成功,就说明 bitsandbytes 的 XPU 支持不仅被加载,而且基本功能是可用的。
源码构建尝试是不必要的,因为预构建包本身就集成了 IPEX 提供的 XPU 支持。

用一个更通用的 PyTorch 方法来检查 XPU 设备是否可用,然后再测试 bitsandbytes:
Code:
import torch import bitsandbytes as bnb # 使用 PyTorch 的原生方法检查 XPU 设备 xpu_available = torch.xpu.is_available() # 注意是 torch.xpu,不是 ipex.xpu print(f"PyTorch XPU available: {xpu_available}") print(f"Number of XPU devices: {torch.xpu.device_count()}") if xpu_available:     print("\nXPU appears to be supported by bitsandbytes via IPEX integration.")     print("The message 'Register pytorch bitsandbytes kernels for XPU...' during import confirms the XPU backend was registered.")     # 尝试创建一个简单的量化的 Linear4bit 层并移动到 XPU     try:         linear_4bit = bnb.nn.Linear4bit(100, 100)         linear_4bit = linear_4bit.to('xpu')         print(f"\nLinear4bit layer successfully moved to XPU: {linear_4bit.weight.device}")         # 尝试一次前向传播         dummy_input = torch.randn(10, 100, device='xpu')         output = linear_4bit(dummy_input)         print(f"Forward pass successful. Output shape: {output.shape}, device: {output.device}")     except Exception as e:         print(f"\nFailed during Linear4bit creation/move/forward on XPU: {e}") else:     print("\nXPU is not available according to PyTorch, so bitsandbytes XPU backend won't function.")


如果 torch.xpu.is_available() 返回 True 并且 Linear4bit 层能够成功移动到 XPU 并执行前向传播,那就几乎可以完全确定 bitsandbytes 的 XPU 支持在您的 Windows 系统上已经正常工作了。

完美!恭喜!
所有测试都成功了:
  1. PyTorch XPU available: True - PyTorch 检测到 XPU 设备可用。
  2. Number of XPU devices: 1 - 检测到一个 XPU 设备。
  3. Register pytorch bitsandbytes kernels for XPU... - bitsandbytes 导入时成功注册了 XPU 后端。
  4. Linear4bit layer successfully moved to XPU: xpu:0 - bitsandbytes 的量化层成功移动到了 XPU。
  5. Forward pass successful. Output shape: torch.Size([10, 100]), device: xpu:0 - 在 XPU 上成功执行了前向传播。
总结:
  • bitsandbytes 的 XPU 支持在您的 Windows 系统上 已成功启用并正常工作。
  • 它是通过 intel-extension-for-pytorch (IPEX) 与 bitsandbytes 的集成实现的,利用了 PyTorch 的 torch.library 机制在运行时动态注册 XPU 后端。
  • 我们之前尝试从源码构建 XPU 后端是不必要的,因为标准的预构建 bitsandbytes 包(版本 0.49.1)就已经包含了与 IPEX 集成以启用 XPU 支持的逻辑。
  • 关键在于您的环境中同时安装了兼容的 torch (带有 XPU 支持) 和 intel-extension-for-pytorch。
您现在可以放心地在您的 LLM 项目(如 LlamaFactory)中使用 bitsandbytes 的量化功能(如 load_in_8bit=True 或 load_in_4bit=True),并且它们应该能够在您的 Intel GPU (XPU) 上运行。
Last edit: 28 Jan 2026 17:13 by service.

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 234

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 237

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 239

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 189

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 237

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 239

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum
FaLang translation system by Faboba

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100
mysqli object is already closed (500 Whoops, looks like something went wrong.)

Error

HTTP 500 Whoops, looks like something went wrong.

mysqli object is already closed

Exception

Error

  1. */
  2. public function disconnect()
  3. {
  4. // Close the connection.
  5. if (\is_callable([$this->connection, 'close'])) {
  6. $this->connection->close();
  7. }
  8. parent::disconnect();
  9. }
  1. */
  2. public function disconnect()
  3. {
  4. // Close the connection.
  5. if (\is_callable([$this->connection, 'close'])) {
  6. $this->connection->close();
  7. }
  8. parent::disconnect();
  9. }
  1. *
  2. * @since 2.0.0
  3. */
  4. public function __destruct()
  5. {
  6. $this->disconnect();
  7. }
  8. /**
  9. * Alter database's character set.
  10. *
DatabaseDriver->__destruct()

Stack Trace

Error
Error:
mysqli object is already closed

  at /var/www/html/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:318
  at mysqli->close()
     (/var/www/html/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:318)
  at Joomla\Database\Mysqli\MysqliDriver->disconnect()
     (/var/www/html/libraries/vendor/joomla/database/src/DatabaseDriver.php:496)
  at Joomla\Database\DatabaseDriver->__destruct()                

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100