bitsandbytes-cpu-fork 0.50.2.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. bitsandbytes_cpu_fork-0.50.2.dev0/LICENSE +21 -0
  2. bitsandbytes_cpu_fork-0.50.2.dev0/MANIFEST.in +24 -0
  3. bitsandbytes_cpu_fork-0.50.2.dev0/PKG-INFO +367 -0
  4. bitsandbytes_cpu_fork-0.50.2.dev0/README.md +335 -0
  5. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/__init__.py +81 -0
  6. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/__main__.py +4 -0
  7. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/_ops.py +526 -0
  8. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/autograd/__init__.py +0 -0
  9. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/autograd/_functions.py +491 -0
  10. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/__init__.py +0 -0
  11. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/cpu/__init__.py +0 -0
  12. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/cpu/ops.py +805 -0
  13. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/cuda/__init__.py +0 -0
  14. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/cuda/ops.py +1212 -0
  15. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/default/__init__.py +0 -0
  16. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/default/ops.py +632 -0
  17. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/hpu/__init__.py +0 -0
  18. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/hpu/ops.py +53 -0
  19. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/mps/__init__.py +0 -0
  20. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/mps/ops.py +277 -0
  21. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/triton/__init__.py +0 -0
  22. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/triton/kernels_4bit.py +577 -0
  23. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/triton/kernels_8bit_quant.py +195 -0
  24. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/triton/kernels_optim.py +1177 -0
  25. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/triton/ops.py +304 -0
  26. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/utils.py +94 -0
  27. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/xpu/__init__.py +0 -0
  28. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/backends/xpu/ops.py +305 -0
  29. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/cextension.py +405 -0
  30. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/consts.py +12 -0
  31. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/cuda_specs.py +111 -0
  32. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/diagnostics/__init__.py +0 -0
  33. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/diagnostics/cuda.py +193 -0
  34. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/diagnostics/main.py +134 -0
  35. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/diagnostics/utils.py +12 -0
  36. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/functional.py +1836 -0
  37. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/gdn_cpu.py +602 -0
  38. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/libbitsandbytes_cpu.dll +0 -0
  39. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/nn/__init__.py +19 -0
  40. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/nn/modules.py +1220 -0
  41. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/nn/parametrize.py +206 -0
  42. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/optim/__init__.py +22 -0
  43. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/optim/adagrad.py +187 -0
  44. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/optim/adam.py +346 -0
  45. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/optim/adamw.py +337 -0
  46. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/optim/ademamix.py +410 -0
  47. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/optim/lamb.py +190 -0
  48. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/optim/lars.py +259 -0
  49. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/optim/lion.py +266 -0
  50. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/optim/optimizer.py +756 -0
  51. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/optim/rmsprop.py +170 -0
  52. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/optim/sgd.py +152 -0
  53. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/py.typed +0 -0
  54. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes/utils.py +208 -0
  55. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes_cpu_fork.egg-info/PKG-INFO +367 -0
  56. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes_cpu_fork.egg-info/SOURCES.txt +127 -0
  57. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes_cpu_fork.egg-info/dependency_links.txt +1 -0
  58. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes_cpu_fork.egg-info/requires.txt +7 -0
  59. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes_cpu_fork.egg-info/top_level.txt +1 -0
  60. bitsandbytes_cpu_fork-0.50.2.dev0/build_linux.sh +108 -0
  61. bitsandbytes_cpu_fork-0.50.2.dev0/build_manual/bench_amd.exe +0 -0
  62. bitsandbytes_cpu_fork-0.50.2.dev0/build_manual/build_aggressive.log +27 -0
  63. bitsandbytes_cpu_fork-0.50.2.dev0/build_manual/build_manual.bat +196 -0
  64. bitsandbytes_cpu_fork-0.50.2.dev0/build_manual/export.def +39 -0
  65. bitsandbytes_cpu_fork-0.50.2.dev0/build_manual/export.def.bak +27 -0
  66. bitsandbytes_cpu_fork-0.50.2.dev0/build_manual/selftest_cpu.exe +0 -0
  67. bitsandbytes_cpu_fork-0.50.2.dev0/build_manual/selftest_win.bat +37 -0
  68. bitsandbytes_cpu_fork-0.50.2.dev0/build_termux.sh +215 -0
  69. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/avx2_gemv_4bit.h +249 -0
  70. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/common.cuh +104 -0
  71. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/common.h +7 -0
  72. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/compat.cuh +206 -0
  73. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/compat_device.cuh +51 -0
  74. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/cpu_cache.h +198 -0
  75. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/cpu_gdn.cpp +728 -0
  76. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/cpu_ops.cpp +3988 -0
  77. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/cpu_ops.cpp.bak +2973 -0
  78. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/cpu_ops.h +601 -0
  79. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/cpu_ops.h.bak +502 -0
  80. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/gemm_4bit.cu +167 -0
  81. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/gemm_4bit_common.cuh +105 -0
  82. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/gemm_4bit_mma.cuh +125 -0
  83. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/gemm_4bit_simt.cu +547 -0
  84. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/gemm_4bit_simt.cuh +16 -0
  85. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/gemm_4bit_sm75.cu +416 -0
  86. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/gemm_4bit_sm75.cuh +16 -0
  87. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/gemm_4bit_sm80.cu +699 -0
  88. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/gemm_4bit_sm80.cuh +16 -0
  89. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/kernels.cu +1863 -0
  90. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/kernels.cuh +85 -0
  91. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/ops.cu +602 -0
  92. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/ops.cuh +151 -0
  93. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/pythonInterface.cpp +1016 -0
  94. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/pythonInterface.cpp.bak +923 -0
  95. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/test_avx2_gemv_4bit.cpp +131 -0
  96. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/test_cpu_cache.cpp +21 -0
  97. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/test_cpu_cache.exe +0 -0
  98. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/xpu_kernels.cpp +282 -0
  99. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/xpu_kernels.h +53 -0
  100. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/xpu_ops.cpp +103 -0
  101. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/xpu_ops.h +41 -0
  102. bitsandbytes_cpu_fork-0.50.2.dev0/docs_cpu/QUICKSTART.md +731 -0
  103. bitsandbytes_cpu_fork-0.50.2.dev0/docs_cpu/QUICKSTART_EN.md +757 -0
  104. bitsandbytes_cpu_fork-0.50.2.dev0/docs_cpu/TECHNICAL_GUIDE.md +505 -0
  105. bitsandbytes_cpu_fork-0.50.2.dev0/docs_cpu/TECHNICAL_GUIDE_EN.md +602 -0
  106. bitsandbytes_cpu_fork-0.50.2.dev0/docs_cpu/TECH_REPORT.md +617 -0
  107. bitsandbytes_cpu_fork-0.50.2.dev0/docs_cpu/TECH_REPORT_EN.md +654 -0
  108. bitsandbytes_cpu_fork-0.50.2.dev0/docs_cpu/__pycache__/check_docs.cpython-311.pyc +0 -0
  109. bitsandbytes_cpu_fork-0.50.2.dev0/docs_cpu/check_docs.py +157 -0
  110. bitsandbytes_cpu_fork-0.50.2.dev0/examples/compile_inference.py +32 -0
  111. bitsandbytes_cpu_fork-0.50.2.dev0/examples/cpu/cpu_training.py +370 -0
  112. bitsandbytes_cpu_fork-0.50.2.dev0/examples/int8_inference_huggingface.py +19 -0
  113. bitsandbytes_cpu_fork-0.50.2.dev0/examples/xpu/benchmark_paged_memory.py +253 -0
  114. bitsandbytes_cpu_fork-0.50.2.dev0/examples/xpu/paged_xpu_training.py +369 -0
  115. bitsandbytes_cpu_fork-0.50.2.dev0/pyproject.toml +83 -0
  116. bitsandbytes_cpu_fork-0.50.2.dev0/selftest_cpu.c +269 -0
  117. bitsandbytes_cpu_fork-0.50.2.dev0/setup.cfg +4 -0
  118. bitsandbytes_cpu_fork-0.50.2.dev0/setup.py +91 -0
  119. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_autograd.py +232 -0
  120. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_cpu_e2e.py +93 -0
  121. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_cuda_setup_evaluator.py +135 -0
  122. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_functional.py +1049 -0
  123. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_generation.py +122 -0
  124. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_linear4bit.py +614 -0
  125. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_linear8bitlt.py +366 -0
  126. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_modules.py +494 -0
  127. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_ops.py +474 -0
  128. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_optim.py +743 -0
  129. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_parametrize.py +499 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Facebook, Inc. and its affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,24 @@
1
+ # Files for the source distribution (sdist).
2
+ #
3
+ # The inherited manifest referenced the upstream CUDA layout:
4
+ # include CMakeLists.txt
5
+ # graft csrc
6
+ # graft include
7
+ # `include/` does not exist in this fork -- it held upstream's CUDA headers -- so
8
+ # every sdist build printed "no directories found matching 'include'", and
9
+ # CMakeLists.txt is unused now that the wheel ships a prebuilt CPU DLL instead of
10
+ # compiling anything.
11
+ #
12
+ # csrc is kept deliberately: it is what build_manual.bat / build_linux.sh /
13
+ # build_termux.sh compile when someone wants to rebuild the kernel themselves,
14
+ # which is the difference between an sdist that is merely installable and one that
15
+ # is actually useful.
16
+ graft csrc
17
+ graft build_manual
18
+ graft docs_cpu
19
+ graft examples
20
+ include build_linux.sh
21
+ include build_termux.sh
22
+ include selftest_cpu.c
23
+ include README.md
24
+ include LICENSE
@@ -0,0 +1,367 @@
1
+ Metadata-Version: 2.4
2
+ Name: bitsandbytes-cpu-fork
3
+ Version: 0.50.2.dev0
4
+ Summary: bitsandbytes with a pure-CPU training backend (AVX2 / NEON): 8-bit optimizers, fused GDN, gemm_8bit, disk balancer. No GPU required.
5
+ License-Expression: MIT
6
+ Project-URL: repository, https://github.com/Ganyvnanoaa09-0906/bitsandbytes-CPU
7
+ Project-URL: Upstream bitsandbytes, https://github.com/bitsandbytes-foundation/bitsandbytes
8
+ Keywords: cpu,optimizers,optimization,8-bit,quantization,compression,avx2,neon
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: C++
15
+ Classifier: Programming Language :: Python :: Implementation :: CPython
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: torch<3,>=2.4
26
+ Requires-Dist: numpy>=1.17
27
+ Requires-Dist: packaging>=20.9
28
+ Provides-Extra: test
29
+ Requires-Dist: pytest~=8.3; extra == "test"
30
+ Requires-Dist: psutil>=5.9; extra == "test"
31
+ Dynamic: license-file
32
+
33
+ <p align="center"><img src="https://avatars.githubusercontent.com/u/175231607?s=200&v=4" alt=""></p>
34
+ <h1 align="center">bitsandbytes</h1>
35
+ <p align="center">
36
+ <a href="https://github.com/bitsandbytes-foundation/bitsandbytes/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/bitsandbytes-foundation/bitsandbytes.svg?color=blue"></a>
37
+ <a href="https://pepy.tech/project/bitsandbytes"><img alt="Downloads" src="https://static.pepy.tech/badge/bitsandbytes/month"></a>
38
+ <a href="https://github.com/bitsandbytes-foundation/bitsandbytes/actions/workflows/tests-nightly.yml"><img alt="Nightly Unit Tests" src="https://img.shields.io/github/actions/workflow/status/bitsandbytes-foundation/bitsandbytes/tests-nightly.yml?logo=github&label=Nightly%20Tests"></a>
39
+ <a href="https://github.com/bitsandbytes-foundation/bitsandbytes/releases"><img alt="GitHub Release" src="https://img.shields.io/github/v/release/bitsandbytes-foundation/bitsandbytes"></a>
40
+ <a href="https://pypi.org/project/bitsandbytes/"><img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/bitsandbytes"></a>
41
+ </p>
42
+
43
+ `bitsandbytes` enables accessible large language models via k-bit quantization for PyTorch. We provide three main features for dramatically reducing memory consumption for inference and training:
44
+
45
+ * 8-bit optimizers uses block-wise quantization to maintain 32-bit performance at a small fraction of the memory cost.
46
+ * LLM.int8() or 8-bit quantization enables large language model inference with only half the required memory and without any performance degradation. This method is based on vector-wise quantization to quantize most features to 8-bits and separately treating outliers with 16-bit matrix multiplication.
47
+ * QLoRA or 4-bit quantization enables large language model training with several memory-saving techniques that don't compromise performance. This method quantizes a model to 4-bits and inserts a small set of trainable low-rank adaptation (LoRA) weights to allow training.
48
+
49
+ The library includes quantization primitives for 8-bit & 4-bit operations, through `bitsandbytes.nn.Linear8bitLt` and `bitsandbytes.nn.Linear4bit` and 8-bit optimizers through `bitsandbytes.optim` module.
50
+
51
+ ## System Requirements
52
+ bitsandbytes has the following minimum requirements for all platforms:
53
+
54
+ * Python 3.10+
55
+ * [PyTorch](https://pytorch.org/get-started/locally/) 2.4+
56
+ * _Note: While we aim to provide wide backwards compatibility, we recommend using the latest version of PyTorch for the best experience._
57
+
58
+ #### Accelerator support:
59
+
60
+ <small>Note: this table reflects the status of the current development branch. For the latest stable release, see the
61
+ [document in the 0.50.0 tag](https://github.com/bitsandbytes-foundation/bitsandbytes/blob/0.50.0/README.md#accelerator-support).
62
+ </small>
63
+
64
+ ##### Legend:
65
+ 🚧 = Planned |
66
+ 〰️ = Partially Supported |
67
+ ✅ = Supported |
68
+ ❌ = Not Supported
69
+
70
+ <table>
71
+ <thead>
72
+ <tr>
73
+ <th>Platform</th>
74
+ <th>Accelerator</th>
75
+ <th>Hardware Requirements</th>
76
+ <th>LLM.int8()</th>
77
+ <th>QLoRA 4-bit</th>
78
+ <th>8-bit Optimizers</th>
79
+ </tr>
80
+ </thead>
81
+ <tbody>
82
+ <tr>
83
+ <td colspan="6">🐧 <strong>Linux, glibc >= 2.24</strong></td>
84
+ </tr>
85
+ <tr>
86
+ <td align="right">x86-64</td>
87
+ <td>◻️ CPU</td>
88
+ <td>Minimum: AVX2<br>Optimized: AVX512F, AVX512BF16</td>
89
+ <td>✅</td>
90
+ <td>✅</td>
91
+ <td>✅</td>
92
+ </tr>
93
+ <tr>
94
+ <td></td>
95
+ <td>🟩 NVIDIA GPU <br><code>cuda</code></td>
96
+ <td>SM60+ minimum<br>SM75+ recommended</td>
97
+ <td>✅</td>
98
+ <td>✅</td>
99
+ <td>✅</td>
100
+ </tr>
101
+ <tr>
102
+ <td></td>
103
+ <td>🟥 AMD GPU <br><code>cuda</code></td>
104
+ <td>
105
+ CDNA: gfx908, gfx90a, gfx942, gfx950, gfx1250<br>
106
+ RDNA: gfx103X, gfx110X, gfx115X, gfx120X
107
+ </td>
108
+ <td>✅</td>
109
+ <td>✅</td>
110
+ <td>✅</td>
111
+ </tr>
112
+ <tr>
113
+ <td></td>
114
+ <td>🟦 Intel GPU <br><code>xpu</code></td>
115
+ <td>
116
+ Data Center GPU Max Series<br>
117
+ Arc A-Series (Alchemist)<br>
118
+ Arc B-Series (Battlemage)
119
+ </td>
120
+ <td>✅</td>
121
+ <td>✅</td>
122
+ <td>✅</td>
123
+ </tr>
124
+ <tr>
125
+ <td></td>
126
+ <td>🟪 Intel Gaudi <br><code>hpu</code></td>
127
+ <td>Gaudi2, Gaudi3</td>
128
+ <td>✅</td>
129
+ <td>〰️</td>
130
+ <td>❌</td>
131
+ </tr>
132
+ <tr>
133
+ <td align="right">aarch64</td>
134
+ <td>◻️ CPU</td>
135
+ <td></td>
136
+ <td>✅ *</td>
137
+ <td>✅</td>
138
+ <td>✅</td>
139
+ </tr>
140
+ <tr>
141
+ <td></td>
142
+ <td>🟩 NVIDIA GPU <br><code>cuda</code></td>
143
+ <td>SM75+</td>
144
+ <td>✅</td>
145
+ <td>✅</td>
146
+ <td>✅</td>
147
+ </tr>
148
+ <tr>
149
+ <td colspan="6">🪟 <strong>Windows 11 / Windows Server 2022+</strong></td>
150
+ </tr>
151
+ <tr>
152
+ <td align="right">x86-64</td>
153
+ <td>◻️ CPU</td>
154
+ <td>AVX2</td>
155
+ <td>✅</td>
156
+ <td>✅</td>
157
+ <td>✅</td>
158
+ </tr>
159
+ <tr>
160
+ <td></td>
161
+ <td>🟩 NVIDIA GPU <br><code>cuda</code></td>
162
+ <td>SM60+ minimum<br>SM75+ recommended</td>
163
+ <td>✅</td>
164
+ <td>✅</td>
165
+ <td>✅</td>
166
+ </tr>
167
+ <tr>
168
+ <td></td>
169
+ <td>🟥 AMD GPU <br><code>cuda</code></td>
170
+ <td>
171
+ RDNA: gfx103X, gfx110X, gfx115X, gfx120X
172
+ </td>
173
+ <td>✅</td>
174
+ <td>✅</td>
175
+ <td>✅</td>
176
+ </tr>
177
+ <tr>
178
+ <td></td>
179
+ <td>🟦 Intel GPU <br><code>xpu</code></td>
180
+ <td>
181
+ Arc A-Series (Alchemist) <br>
182
+ Arc B-Series (Battlemage)
183
+ </td>
184
+ <td>✅</td>
185
+ <td>✅</td>
186
+ <td>✅</td>
187
+ </tr>
188
+ <tr>
189
+ <td align="right">arm64</td>
190
+ <td>◻️ CPU</td>
191
+ <td></td>
192
+ <td>✅</td>
193
+ <td>✅</td>
194
+ <td>✅</td>
195
+ </tr>
196
+ <tr>
197
+ <td></td>
198
+ <td>🟩 NVIDIA GPU <br><code>cuda</code></td>
199
+ <td>SM121</td>
200
+ <td>✅</td>
201
+ <td>✅</td>
202
+ <td>✅</td>
203
+ </tr>
204
+ <tr>
205
+ <td colspan="6">🍎 <strong>macOS 14+</strong></td>
206
+ </tr>
207
+ <tr>
208
+ <td align="right">arm64</td>
209
+ <td>◻️ CPU</td>
210
+ <td>Apple M1+</td>
211
+ <td>✅ *</td>
212
+ <td>✅</td>
213
+ <td>✅</td>
214
+ </tr>
215
+ <tr>
216
+ <td></td>
217
+ <td>⬜ Metal <br><code>mps</code></td>
218
+ <td>Apple M1+</td>
219
+ <td>✅ *</td>
220
+ <td>✅</td>
221
+ <td>🚧</td>
222
+ </tbody>
223
+ </table>
224
+ <sup>* While supported, these marked features may lack in performance optimizations.</sup>
225
+
226
+ ## :book: Documentation
227
+ * [Official Documentation](https://huggingface.co/docs/bitsandbytes/main)
228
+ * 🤗 [Transformers](https://huggingface.co/docs/transformers/quantization/bitsandbytes)
229
+ * 🤗 [Diffusers](https://huggingface.co/docs/diffusers/quantization/bitsandbytes)
230
+ * 🤗 [PEFT](https://huggingface.co/docs/peft/developer_guides/quantization#quantize-a-model)
231
+
232
+ ## :computer: CPU Backend Extensions (this fork)
233
+
234
+ This fork adds **training-grade CPU kernels** to the bitsandbytes CPU backend, for
235
+ machines **without NVIDIA GPUs** (AVX2 only / ARM64 NEON, e.g. consumer laptops,
236
+ Mini-PCs). The upstream CPU backend is inference-oriented; these
237
+ extensions make pure-CPU LoRA / quantization / diffusion training practical.
238
+
239
+ ### Install (Windows, no compiler needed)
240
+
241
+ The wheel bundles the prebuilt CPU kernel and its OpenMP runtime, so nothing has to
242
+ be built after installing:
243
+
244
+ ```bash
245
+ pip install https://github.com/Ganyvnanoaa09-0906/bitsandbytes-CPU/releases/download/v0.50.2.dev0-cpu/bitsandbytes_cpu_fork-0.50.2.dev0-py3-none-win_amd64.whl
246
+ ```
247
+
248
+ One wheel covers every Python 3 version on 64-bit Windows. `pip` pulls `torch` and
249
+ `numpy` itself. The import name is unchanged, so existing code and the
250
+ Transformers / PEFT / Diffusers integrations keep working as-is:
251
+
252
+ ```python
253
+ import bitsandbytes as bnb # the fork, not upstream
254
+ print(bnb.__version__) # 0.50.2.dev0
255
+ ```
256
+
257
+ Building from source instead (any platform) is described in
258
+ [`docs_cpu/QUICKSTART.md`](docs_cpu/QUICKSTART.md) §2 and §2A.
259
+
260
+ > 📚 **Docs** (`docs_cpu/`):
261
+ > - `TECHNICAL_GUIDE.md` — **技术文档**:改了什么、每个内核的架构与细节(面向技术人员)
262
+ > - `QUICKSTART.md` — **快速入门手册**:命令、用途与参数(面向首次使用者)
263
+ > - `TECH_REPORT.md` — **技术报告**:完整方法论、实验数据与结论(含负面结论)
264
+ > - 灾难恢复指南已并入 `QUICKSTART.md` §9。
265
+ > - 🌐 **English**: 英文为**独立文件** —— `QUICKSTART_EN.md`、`TECHNICAL_GUIDE_EN.md`、
266
+ > `TECH_REPORT_EN.md`(内容与中文版对应,以中文为准;灾难恢复同样在 `QUICKSTART_EN.md` §9)。
267
+ >
268
+ > 🌐 **English README**: see [`README_EN.md`](README_EN.md).
269
+ >
270
+ > > **关于硬盘均衡负载**:它能在内存紧张时帮助维持训练,但**不能替代 Windows 虚拟内存**。
271
+ > > 训练期间仍**建议保留至少 1GB 虚拟内存**以应对突发内存峰值。
272
+
273
+ ### What's added
274
+
275
+ | Kernel | Entry point | Purpose |
276
+ |---|---|---|
277
+ | **Gated DeltaNet fwd/bwd** | `gdn_fwd_cpu` / `gdn_bwd_cpu` (csrc/cpu_gdn.cpp) | Fused Gated DeltaNet (Qwen3-Next/3.5 linear attention) — ~35× vs per-step Python loop; chunk-checkpointed backward |
278
+ | **Fused 8-bit blockwise dequant GEMM** | `cgemm_8bit_inference_cpu_fp32` (`bitsandbytes::gemm_8bit`, `bnb.functional.fused_dequant_linear_8bit`) | `out = A @ dequant8(B)` with weights kept uint8 (¼ DRAM traffic), no fp32 temporary |
279
+ | **Fused 8-bit optimizer** | `coptimizer_update_8bit_blockwise_cpu` (`bnb.optim.AdamW8bit` etc.) | Single-pass dequant→update→requant; optimizer state memory ≈ 1/3.8 of fp32 |
280
+ | **Blockwise 8/4-bit quant & dequant** | `cquantize_blockwise_cpu_*` / `cdequantize_blockwise_cpu_*` | AVX2 LUT quantize + dequantize; NF4/FP4 kernels with NEON/AVX2 paths |
281
+ | **4-bit inference GEMV** | `cgemv_4bit_inference_cpu_*` | Fused 4-bit dequant GEMV/GEMM for AVX2 machines (symbol alias fixed) |
282
+ | **GDN runtime patch** | `bitsandbytes/gdn_cpu.py` | `patch_transformers()` / `patch_fla()` — route transformers GDN slow paths to the fused kernel |
283
+ | **iGPU (DirectML) block-level executor** | `gpu_scheduler.py` (`IgpuExecutor`, `train.py --igpu`) | Experimental: frozen weights resident on the DirectML iGPU, forward/backward on-device, **one sync per step**; **off by default** — measured **+30~35%** for GEMM-dense seq≤256 training, **negative** at long sequences (driver limits) |
284
+
285
+ ### Build
286
+
287
+ ```bash
288
+ # Linux (x86_64 AVX2 or aarch64 NEON, g++/clang + OpenMP)
289
+ # deps: sudo apt install g++ libomp-dev (Debian/Ubuntu)
290
+ bash build_linux.sh # -> bitsandbytes/libbitsandbytes_cpu.so
291
+ bash build_linux.sh --selftest # also build+run torch-free C self-test
292
+
293
+ # Windows (MSVC, manual cl build, no CMake)
294
+ build_manual\build_manual.bat amd # (in VS x64 Native Tools prompt)
295
+ ```
296
+
297
+ > `.gitattributes` 强制 C/C++ 源码与构建脚本用 LF 换行,clone 到 Windows/Linux 均可
298
+ > 直接编译(CRLF 会让 MSVC 吞行、Linux `g++` 报 `bad interpreter`)。
299
+ > `disk_balancer`(`--flash`)跨平台:Windows 用 ctypes,Linux/WSL 用 psutil。
300
+
301
+ ### Prebuilt wheels (optional)
302
+
303
+ 预编译的 wheel(`pip install bitsandbytes-<ver>-py3-none-<platform>.whl`)可从 **Release**
304
+ 获取,无需自己编译(Windows `win_amd64` / Linux `linux_x86_64` / aarch64
305
+ `linux_aarch64`)。wheel 内含 `bitsandbytes/` 包 + 编译好的 native 库
306
+ (`.dll`/`.so`),安装即用。
307
+
308
+ ### Self-test (no torch required)
309
+
310
+ ```bash
311
+ # C-level kernel self-test: quantize roundtrip / gemm_8bit / 4bit GEMV / 8bit optimizer
312
+ bash build_linux.sh --selftest
313
+ ```
314
+
315
+ ### Notes
316
+
317
+ - This fork is based on bitsandbytes v0.45.1 (MIT, Facebook) and keeps the upstream
318
+ MIT license. See `NOTICE.md` for contributions.
319
+ - The CPU backend keeps the upstream NEON/AVX paths for plain quant/dequant;
320
+ the **fused training kernels** (GDN, gemm_8bit, 8-bit optimizer) are the
321
+ addition of this fork.
322
+ - Not recommended for use without the compiled native library — build first
323
+ (Windows: `build_manual\build_manual.bat amd`, Linux: `build_linux.sh`).
324
+
325
+ ## :heart: Sponsors
326
+ The continued maintenance and development of `bitsandbytes` is made possible thanks to the generous support of our sponsors. Their contributions help ensure that we can keep improving the project and delivering valuable updates to the community.
327
+
328
+ <kbd><a href="https://hf.co" target="_blank"><img width="100" src="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg" alt="Hugging Face"></a></kbd>
329
+
330
+ ## License
331
+ `bitsandbytes` is MIT licensed.
332
+
333
+ ## How to cite us
334
+ If you found this library useful, please consider citing our work:
335
+
336
+ ### QLoRA
337
+
338
+ ```bibtex
339
+ @article{dettmers2023qlora,
340
+ title={Qlora: Efficient finetuning of quantized llms},
341
+ author={Dettmers, Tim and Pagnoni, Artidoro and Holtzman, Ari and Zettlemoyer, Luke},
342
+ journal={arXiv preprint arXiv:2305.14314},
343
+ year={2023}
344
+ }
345
+ ```
346
+
347
+ ### LLM.int8()
348
+
349
+ ```bibtex
350
+ @article{dettmers2022llmint8,
351
+ title={LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale},
352
+ author={Dettmers, Tim and Lewis, Mike and Belkada, Younes and Zettlemoyer, Luke},
353
+ journal={arXiv preprint arXiv:2208.07339},
354
+ year={2022}
355
+ }
356
+ ```
357
+
358
+ ### 8-bit Optimizers
359
+
360
+ ```bibtex
361
+ @article{dettmers2022optimizers,
362
+ title={8-bit Optimizers via Block-wise Quantization},
363
+ author={Dettmers, Tim and Lewis, Mike and Shleifer, Sam and Zettlemoyer, Luke},
364
+ journal={9th International Conference on Learning Representations, ICLR},
365
+ year={2022}
366
+ }
367
+ ```