bitsandbytes-cpu-fork 0.50.2.dev8__tar.gz → 0.50.2.dev10__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 (166) hide show
  1. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/LICENSE +21 -21
  2. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/MANIFEST.in +35 -35
  3. {bitsandbytes_cpu_fork-0.50.2.dev8/bitsandbytes_cpu_fork.egg-info → bitsandbytes_cpu_fork-0.50.2.dev10}/PKG-INFO +71 -8
  4. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/README.md +70 -7
  5. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/__init__.py +84 -84
  6. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/__main__.py +4 -4
  7. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/_cpu_caps.py +110 -110
  8. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/_ops.py +526 -526
  9. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/autograd/_functions.py +491 -491
  10. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/cpu/ops.py +819 -819
  11. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/cuda/ops.py +1212 -1212
  12. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/default/ops.py +632 -632
  13. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/hpu/ops.py +53 -53
  14. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/mps/ops.py +277 -277
  15. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/triton/kernels_4bit.py +583 -583
  16. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/triton/kernels_8bit_quant.py +195 -195
  17. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/triton/kernels_optim.py +1177 -1177
  18. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/triton/ops.py +304 -304
  19. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/utils.py +94 -94
  20. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/xpu/ops.py +305 -305
  21. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/cextension.py +447 -447
  22. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/cli.py +50 -50
  23. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/consts.py +12 -12
  24. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/cuda_specs.py +111 -111
  25. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/detect_cpu.py +189 -189
  26. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/diagnostics/cuda.py +193 -193
  27. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/diagnostics/main.py +134 -134
  28. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/diagnostics/utils.py +12 -12
  29. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/disk_balancer.py +1687 -1687
  30. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/efst.py +782 -782
  31. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/functional.py +1836 -1836
  32. bitsandbytes_cpu_fork-0.50.2.dev10/bitsandbytes/fused/__init__.py +21 -0
  33. bitsandbytes_cpu_fork-0.50.2.dev10/bitsandbytes/fused/_native.py +66 -0
  34. bitsandbytes_cpu_fork-0.50.2.dev10/bitsandbytes/fused/_ref.py +62 -0
  35. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/gdn_cpu.py +616 -616
  36. bitsandbytes_cpu_fork-0.50.2.dev10/bitsandbytes/libbitsandbytes_cpu.dll +0 -0
  37. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/nn/__init__.py +19 -19
  38. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/nn/modules.py +1220 -1220
  39. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/nn/parametrize.py +206 -206
  40. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/__init__.py +26 -26
  41. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/adagrad.py +187 -187
  42. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/adam.py +346 -346
  43. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/adamw.py +337 -337
  44. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/adamw4bit.py +239 -239
  45. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/ademamix.py +410 -410
  46. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/lamb.py +190 -190
  47. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/lars.py +259 -259
  48. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/lion.py +266 -266
  49. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/optimizer.py +756 -756
  50. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/rmsprop.py +170 -170
  51. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/optim/sgd.py +152 -152
  52. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/q3bit.py +487 -481
  53. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/torch_cpu_kit.py +794 -794
  54. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/utils.py +208 -208
  55. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes_cpu_cli.py +1062 -1062
  56. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10/bitsandbytes_cpu_fork.egg-info}/PKG-INFO +71 -8
  57. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes_cpu_fork.egg-info/SOURCES.txt +11 -0
  58. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/build_manual/build_manual.bat +234 -234
  59. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/build_manual/export.def +5 -0
  60. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/build_manual/export_generic.def +39 -39
  61. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/build_manual/selftest_win.bat +37 -37
  62. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/avx2_gemv_4bit.h +25 -3
  63. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/common.cuh +105 -105
  64. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/compat.cuh +206 -206
  65. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/compat_device.cuh +51 -51
  66. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/cpu_ops.cpp +45 -19
  67. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/gemm_4bit.cu +168 -168
  68. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/gemm_4bit_common.cuh +105 -105
  69. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/gemm_4bit_mma.cuh +125 -125
  70. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/gemm_4bit_simt.cu +547 -547
  71. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/gemm_4bit_simt.cuh +16 -16
  72. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/gemm_4bit_sm75.cu +416 -416
  73. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/gemm_4bit_sm75.cuh +16 -16
  74. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/gemm_4bit_sm80.cu +699 -699
  75. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/gemm_4bit_sm80.cuh +16 -16
  76. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/kernels.cu +1863 -1863
  77. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/kernels.cuh +85 -85
  78. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/ops.cu +602 -602
  79. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/ops.cuh +151 -151
  80. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/test_avx2_gemv_4bit.cpp +51 -4
  81. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/API_REFERENCE.md +20 -5
  82. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/API_REFERENCE_EN.md +5 -5
  83. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/ISA_MATRIX.md +2 -2
  84. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/QUICKSTART.md +77 -0
  85. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/QUICKSTART_EN.md +88 -0
  86. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/TECH_REPORT.md +71 -0
  87. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/TECH_REPORT_EN.md +84 -0
  88. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/check_docs.py +157 -157
  89. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/examples/compile_inference.py +32 -32
  90. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/examples/cpu/cpu_training.py +370 -370
  91. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/examples/int8_inference_huggingface.py +19 -19
  92. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/examples/xpu/benchmark_paged_memory.py +253 -253
  93. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/examples/xpu/paged_xpu_training.py +369 -369
  94. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/pyproject.toml +124 -124
  95. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/setup.py +175 -175
  96. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_autograd.py +232 -232
  97. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_cpu_e2e.py +201 -201
  98. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_cuda_setup_evaluator.py +135 -135
  99. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_functional.py +1049 -1049
  100. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_generation.py +122 -122
  101. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_linear4bit.py +614 -614
  102. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_linear8bitlt.py +366 -366
  103. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_modules.py +494 -494
  104. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_ops.py +474 -474
  105. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_optim.py +743 -743
  106. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_parametrize.py +499 -499
  107. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tests/test_rmsnorm_fwd_cpu.py +198 -198
  108. bitsandbytes_cpu_fork-0.50.2.dev10/tools/carve_selftest.py +225 -0
  109. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/create_github_release.ps1 +169 -169
  110. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/dump_signatures.py +64 -64
  111. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/gen_api_reference.py +43 -43
  112. bitsandbytes_cpu_fork-0.50.2.dev10/tools/mft_recover.c +148 -0
  113. bitsandbytes_cpu_fork-0.50.2.dev10/tools/mft_recover_gui.c +643 -0
  114. bitsandbytes_cpu_fork-0.50.2.dev10/tools/mft_recover_gui.manifest +37 -0
  115. bitsandbytes_cpu_fork-0.50.2.dev10/tools/mft_selftest.py +515 -0
  116. bitsandbytes_cpu_fork-0.50.2.dev10/tools/mftcore.h +690 -0
  117. bitsandbytes_cpu_fork-0.50.2.dev10/tools/patch_dev9.py +75 -0
  118. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/publish.ps1 +99 -99
  119. bitsandbytes_cpu_fork-0.50.2.dev10/tools/recovery_pipeline_selftest.py +347 -0
  120. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/sector_carve.c +233 -15
  121. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/sector_carve_gui.c +222 -16
  122. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/sector_mirror.c +97 -2
  123. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/sector_mirror_gui.c +318 -20
  124. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/train_llm_sft.py +136 -111
  125. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/verify_help_examples.py +213 -213
  126. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/verify_train_release.py +90 -90
  127. bitsandbytes_cpu_fork-0.50.2.dev8/bitsandbytes/libbitsandbytes_cpu.dll +0 -0
  128. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/autograd/__init__.py +0 -0
  129. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/__init__.py +0 -0
  130. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/cpu/__init__.py +0 -0
  131. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/cuda/__init__.py +0 -0
  132. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/default/__init__.py +0 -0
  133. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/hpu/__init__.py +0 -0
  134. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/mps/__init__.py +0 -0
  135. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/triton/__init__.py +0 -0
  136. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/backends/xpu/__init__.py +0 -0
  137. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/diagnostics/__init__.py +0 -0
  138. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/py.typed +0 -0
  139. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes/vcomp140.dll +0 -0
  140. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes_cpu_fork.egg-info/dependency_links.txt +0 -0
  141. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes_cpu_fork.egg-info/entry_points.txt +0 -0
  142. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes_cpu_fork.egg-info/requires.txt +0 -0
  143. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/bitsandbytes_cpu_fork.egg-info/top_level.txt +0 -0
  144. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/build_linux.sh +0 -0
  145. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/build_manual/export_avx512.def +0 -0
  146. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/build_termux.sh +0 -0
  147. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/common.h +0 -0
  148. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/cpu_cache.h +0 -0
  149. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/cpu_features.h +0 -0
  150. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/cpu_gdn.cpp +0 -0
  151. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/cpu_ops.h +0 -0
  152. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/pythonInterface.cpp +0 -0
  153. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/test_cpu_cache.cpp +0 -0
  154. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/xpu_kernels.cpp +0 -0
  155. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/xpu_kernels.h +0 -0
  156. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/xpu_ops.cpp +0 -0
  157. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/csrc/xpu_ops.h +0 -0
  158. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/EPYC_VALIDATION.md +0 -0
  159. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/MOTION_BOUNDARY.md +0 -0
  160. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/MOTION_BOUNDARY_EN.md +0 -0
  161. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/TECHNICAL_GUIDE.md +0 -0
  162. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/TECHNICAL_GUIDE_EN.md +0 -0
  163. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/docs_cpu/WHEEL_PLATFORM_NOTES.md +0 -0
  164. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/selftest_cpu.c +0 -0
  165. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/setup.cfg +0 -0
  166. {bitsandbytes_cpu_fork-0.50.2.dev8 → bitsandbytes_cpu_fork-0.50.2.dev10}/tools/verify_linux_cli.sh +0 -0
@@ -1,21 +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.
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.
@@ -1,35 +1,35 @@
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
- # tools/ holds gen_api_reference.py and verify_help_examples.py, which regenerate and
21
- # check docs_cpu/API_REFERENCE*.md from the tables in bitsandbytes_cpu_cli.py. The
22
- # generated documents ARE shipped, so leaving the generators out would hand users the
23
- # output of scripts they cannot run.
24
- graft tools
25
- # ...but not the Windows binaries inside it. `graft tools` takes the whole directory,
26
- # and the four sector_*.exe disaster-recovery tools were 0.65 MB of a 1.36 MB sdist --
27
- # nearly half its weight, on every platform, for binaries that cannot run on two of the
28
- # three. Their .c sources stay in the sdist and in the repository.
29
- global-exclude *.exe
30
- global-exclude *.exe.manifest
31
- include build_linux.sh
32
- include build_termux.sh
33
- include selftest_cpu.c
34
- include README.md
35
- include LICENSE
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
+ # tools/ holds gen_api_reference.py and verify_help_examples.py, which regenerate and
21
+ # check docs_cpu/API_REFERENCE*.md from the tables in bitsandbytes_cpu_cli.py. The
22
+ # generated documents ARE shipped, so leaving the generators out would hand users the
23
+ # output of scripts they cannot run.
24
+ graft tools
25
+ # ...but not the Windows binaries inside it. `graft tools` takes the whole directory,
26
+ # and the four sector_*.exe disaster-recovery tools were 0.65 MB of a 1.36 MB sdist --
27
+ # nearly half its weight, on every platform, for binaries that cannot run on two of the
28
+ # three. Their .c sources stay in the sdist and in the repository.
29
+ global-exclude *.exe
30
+ global-exclude *.exe.manifest
31
+ include build_linux.sh
32
+ include build_termux.sh
33
+ include selftest_cpu.c
34
+ include README.md
35
+ include LICENSE
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitsandbytes-cpu-fork
3
- Version: 0.50.2.dev8
3
+ Version: 0.50.2.dev10
4
4
  Summary: bitsandbytes with a pure-CPU training backend (AVX2 / NEON): 8-bit optimizers, fused GDN, gemm_8bit, disk balancer. No GPU required.
5
5
  License-Expression: MIT
6
6
  Project-URL: repository, https://github.com/Ganyvnanoaa09-0906/bitsandbytes-CPU
@@ -36,7 +36,7 @@ Dynamic: license-file
36
36
  > toolkit and no driver** — just an AVX2 x86-64 CPU (or ARM64 NEON), the CPU build of PyTorch,
37
37
  > and 12–16 GB of RAM.
38
38
 
39
- **Version: `0.50.2.dev8`** · import name is unchanged (`import bitsandbytes as bnb`) · MIT.
39
+ **Version: `0.50.2.dev9`** · import name is unchanged (`import bitsandbytes as bnb`) · MIT.
40
40
 
41
41
  What the CPU backend provides: 8-bit blockwise optimizers (≈2.3 bytes of state per parameter
42
42
  instead of 8; the 4-bit optimizer ≈1.03), 4/8-bit layers that run on CPU tensors, the fused
@@ -202,7 +202,7 @@ Also: `estimate_training_memory_gb()`, `spawn_training_jobs(cmds, plan)` (logs p
202
202
  | Area | What it does |
203
203
  |---|---|
204
204
  | 8-bit optimizers | AdamW/Adam/AdEMAMix/LAMB/LARS/Lion + paged variants, blockwise 8-bit state with single-pass dequant→update→requant kernels (AVX2/NEON) |
205
- | 4-bit optimizer | `AdamW4bit`: ≈1.03 bytes of state per parameter (restored in dev8; scalar kernel + torch fallback) |
205
+ | 4-bit optimizer | `AdamW4bit`: ≈1.03 bytes of state per parameter (scalar kernel; native on Linux and, since dev9, Windows) |
206
206
  | Quantisation | blockwise 8-bit, NF4/FP4 4-bit quantize/dequantize; 4-bit GEMV inference kernel |
207
207
  | `gemm_8bit` | `out = A @ dequant8(B)` with weights kept uint8 (¼ DRAM traffic), no fp32 temporary (`bnb.functional.fused_dequant_linear_8bit`) |
208
208
  | GDN | fused Gated DeltaNet forward + chunk-checkpointed backward (`gdn_fwd_cpu` / `gdn_bwd_cpu`), plus `patch_transformers()` / `patch_fla()` |
@@ -215,6 +215,48 @@ The library never loads a CUDA/ROCm/XPU library: `bnb.cuda`/`bnb.optim` CPU path
215
215
 
216
216
  ---
217
217
 
218
+ ## Full fine-tuning vs LoRA
219
+
220
+ `--mode full` (and `bnb.optim.*` directly) fine-tunes **every parameter**; measured on
221
+ Qwen3.5-0.8B (752 M, 100% trainable, fp32 + AdamW8bit, seq 64, batch 1): **peak RSS
222
+ 10.4 GB, 8.8 s/step**, versus LoRA (5.4 M trainable) at **5.9 GB / 2.65 s/step**. On a
223
+ 15.4 GB machine ~0.8 B full fine-tuning is comfortable; ~1 B is tight (estimator:
224
+ 10.7 GB weights+grads+8-bit state before activations), and above that use LoRA / EFST /
225
+ q3bit, or add activation checkpointing (not yet wired into the generic trainer).
226
+
227
+ ## iGPU image inference (experimental)
228
+
229
+ The OpenCL kit is GEMM-oriented (`nn.Linear`/`Conv1D`); diffusion UNets are conv2d-heavy and
230
+ need an im2col+dGEMM conv engine before the OpenCL path can run them. As a proof of concept,
231
+ `gt1030/igpu_image_ort.py` runs an ONNX-exported SD1.5 through ONNX Runtime's
232
+ **DmlExecutionProvider** on the integrated GPU (local `_sd15_combined`, 256x256, DDIM):
233
+
234
+ | path | 8 steps | per step |
235
+ |---|---|---|
236
+ | CPU diffusers (Torch 2.13, 6 threads) | 25.29 s | 3.16 s |
237
+ | **iGPU ONNX Runtime DirectML** | **13.05 s** | **1.63 s** |
238
+
239
+ ≈**1.9x** faster at 256x256; 512x512 currently fails inside the UNet on the DML EP (activation
240
+ memory / operator coverage) while the same ONNX runs on `CPUExecutionProvider`. Export once with
241
+ `optimum-cli export onnx --task stable-diffusion --opset 17`. A diffusers + `torch_directml`
242
+ variant (`igpu_image_infer.py`) is kept as a comparison; it needs legacy attention and still hits
243
+ DML `chunk`/reshape issues. Long-term the OpenCL backend gets an **fp16 device-resident conv engine**: measured probes
244
+ show per-op OpenCL conv is 2-3x slower than CPU oneDNN and fp32 resident only reaches parity,
245
+ but fp16 resident im2col+Hgemm is **1.3-2x faster than the CPU conv** at SD1.5 shapes
246
+ (538 vs 342 GFLOPS; 1280-channel 16x16 layer 17.3 vs 34.8 ms). The 256-resolution demo
247
+ therefore uses DirectML, while the OpenCL engine is the planned production backend.
248
+
249
+ The fp16 device-resident building blocks are in `gt1030/opencl_fp16_ops.py` +
250
+ `gt1030/kernels_attention.cl` (im2col + CLBlast Hgemm conv, GroupNorm+SiLU, LayerNorm,
251
+ GEGLU, multi-head attention, nearest-2x upsample, add). Clean measurements on the
252
+ Vega 6 (no CPU contention), parity 0.02-1.1% relL2:
253
+ ResNetBlock2D 0.61-0.77x, VAE up-block 0.40x, FFN 0.16-0.23x, attention 0.42-0.99x,
254
+ full Transformer block 0.51-0.71x of CPU time -- i.e. 1.3-6x faster for most blocks.
255
+ The **VAE decoder is now end-to-end on the iGPU** (`gt1030/opencl_vae.py`): fp16 parity
256
+ 2.7-3.7% vs CPU, 1.81 s vs 2.07 s at 256 (0.87x), 7.93 s vs 8.34 s at 512 (0.95x, warm).
257
+ The remaining step is assembling the full 256px UNet graph (fp16 weights ~1.7 GB,
258
+ under the 5,090 MB single-allocation limit; 512px needs activation tiling).
259
+
218
260
  ## 3-bit frozen base + LoRA (`bitsandbytes.q3bit`, experimental)
219
261
 
220
262
  A frozen weight can be stored as blockwise **3-bit** codes (≈11% of fp32 memory) and
@@ -256,6 +298,8 @@ R5-4500U (6C/6T, AVX2, 15.4 GB) / i5-10400 (6C/12T, AVX2, 12 GB), no NVIDIA GPU.
256
298
  | Concurrency packing (synthetic jobs) | 6 jobs × 1 thread **5619 tok/s** vs 1 job × 6 threads **3843 tok/s** (+46%) |
257
299
  | Real model (Qwen3.5-0.8B LoRA, seq 64) | 4 threads beat 6 by **7–10%** — measure with `tune_threads()` |
258
300
  | Fused lm_head 3-bit GEMM (research) | 14–22% faster than fp32 matmul, 89% less weight memory |
301
+ | 3-bit frozen base + LoRA (Qwen3-1.7B, CPU) | 80 steps: eval loss 4.34 → **4.03**; RSS **2.9 GB vs 8.7 GB** fp32; step 7.7 s vs 5.5 s (native Windows) |
302
+ | Full-parameter fine-tune (Qwen3.5-0.8B, 752 M, fp32 + AdamW8bit, CPU) | **10.4 GB peak RSS**, 8.8 s/step; LoRA on the same model: 5.9 GB, 2.65 s/step |
259
303
  | AdamW4bit step (1M params) | 28.6 ms vs 3.3 ms for the AVX2 8-bit kernel; state 1.031 vs 2.062 B/param |
260
304
 
261
305
  Not every workload is faster than fp32: 4-bit/8-bit kernels trade compute for memory traffic,
@@ -267,14 +311,15 @@ the full trade-off tables, including negative results.
267
311
  ## Platform limitations
268
312
 
269
313
  - **CPU only.** CUDA/ROCm/XPU kernels are not built; a GPU is never required or used.
270
- - **Windows wheel** ships a prebuilt DLL. That DLL predates the dev5/dev6 2/3-bit
271
- kernels and the restored 4-bit optimizer kernel, so those run the pure-torch
272
- fallback there (same numbers, lower speed).
314
+ - **Windows wheel**: from dev9 on it ships the MSVC DLL built by CI from the current
315
+ `csrc`, which exports the 2/3-bit dequant/GEMM and 4-bit optimizer kernels; they run
316
+ natively on Windows (verified: dequant maxdiff 1.2e-6, 4-bit native vs torch 1.2e-7).
317
+ Wheels older than dev9 fall back to pure torch for those symbols.
273
318
  - **manylinux_2_17 wheel**: the AVX-512 library inside it is single-threaded (the parallel
274
319
  build is only for the native `manylinux_2_39` wheel). On AVX-512 machines set
275
320
  `BNB_CPU_DISABLE_AVX512=1` to run the AVX2 OpenMP path.
276
- - **aarch64**: there is no PyPI wheel yet; build from the sdist (`build_linux.sh`) or use the
277
- Termux instructions in `docs_cpu/TERMUX_GUIDE.md`.
321
+ - **aarch64**: there is no PyPI wheel yet; build from the sdist (`build_linux.sh`) or follow the
322
+ Termux guide [`TERMUX_GUIDE.md`](https://github.com/Ganyvnanoaa09-0906/bitsandbytes-CPU/blob/HEAD/bitsandbytes/TERMUX_GUIDE.md).
278
323
  - **macOS**: no wheel is published and the CPU backend is not tested there; the sdist build may
279
324
  work with clang + OpenMP, but treat it as unsupported.
280
325
  - 3-bit (and 2-bit dequant-only) is **experimental**: the API and kernels are covered
@@ -293,6 +338,23 @@ bash build_linux.sh --selftest # also build + run the torch-free C se
293
338
  build_manual\build_manual.bat amd # run inside "x64 Native Tools Command Prompt"
294
339
  ```
295
340
 
341
+ ### Termux (Android / ARM64)
342
+
343
+ On-device builds work; there is no aarch64 PyPI wheel, so build from the sdist:
344
+
345
+ ```bash
346
+ pkg update && pkg install -y clang libomp make python
347
+ bash build_termux.sh # -> bitsandbytes/libbitsandbytes_cpu.so
348
+ bash build_termux.sh --selftest # also build + run the torch-free C self-test
349
+ ```
350
+
351
+ Three Termux-specific traps the script already handles: the compiler is `clang++` (there is no
352
+ `g++`), OpenMP needs `pkg install libomp`, and `-march=native` is unsafe under Android's clang.
353
+ The script is also what the automated flow uses to build on a phone **driven from a PC over ADB**
354
+ — see [`TERMUX_GUIDE.md`](https://github.com/Ganyvnanoaa09-0906/bitsandbytes-CPU/blob/HEAD/bitsandbytes/TERMUX_GUIDE.md)
355
+ for the phone-side preparation, the ADB/wireless-debugging path, the ARM64 kernel notes and the
356
+ verification matrix.
357
+
296
358
  Two special wheel builds used by this project are documented in
297
359
  [`docs_cpu/WHEEL_PLATFORM_NOTES.md`](https://github.com/Ganyvnanoaa09-0906/bitsandbytes-CPU/blob/HEAD/bitsandbytes/docs_cpu/WHEEL_PLATFORM_NOTES.md):
298
360
  the zig manylinux_2_17 portable build and the devtoolset-8 manylinux_2_17 **OpenMP** build
@@ -334,6 +396,7 @@ The long-form docs live in the repository (`bitsandbytes/docs_cpu/`, Chinese and
334
396
  | `0.50.2.dev6` | manylinux_2_17 wheel is now **OpenMP** (devtoolset-8, bundled libgomp → 3–4× optimizer-kernel speedup on old glibc); csrc 2/3-bit dequant + fused GEMM kernels with 9-item C self-test; EFST fused tensor-expert routing fix; GCC 8 `<cpuid.h>` portability fix |
335
397
  | `0.50.2.dev7` | documentation release: README rewritten for the CPU fork (install/wheels/platform matrix, feature table, measured performance, limitations, tests, full dev1→dev7 changelog, EFST/disk-balancer/toolbox examples) |
336
398
  | `0.50.2.dev8` | **restored `AdamW4bit`** (the kernel was dropped when dev4 vendored upstream; now scalar C kernel + torch fallback, 1.031 B/param); **new `bitsandbytes.q3bit` API** — `quantize_3bit`/`dequantize_3bit`/`gemm_3bit`/`gemm_3bit_transposed`, `QuantLinear3bit` (frozen 3-bit base + LoRA), `convert_linears_3bit`, native kernels on Linux with identical pure-torch fallback; CLI reference now includes 4bitopt/q3bit and all 43 examples execute in CI-style verification |
399
+ | `0.50.2.dev9` | **Windows native kernels**: CI now compiles the MSVC DLL from the current csrc and the export list includes the 4-bit optimizer and 2/3-bit symbols (they were silently missing before); **q3bit real-model validation** on Qwen3-1.7B (frozen 3-bit base + LoRA, eval 4.34→4.03 over 80 steps, RSS −67%, native step 7.7 s vs fp32 5.5 s); fixed the causal-LM **double-shift** label bug in the iGPU training kit (Windows package v0.1.2) |
337
400
 
338
401
  ## License and attribution
339
402
 
@@ -5,7 +5,7 @@
5
5
  > toolkit and no driver** — just an AVX2 x86-64 CPU (or ARM64 NEON), the CPU build of PyTorch,
6
6
  > and 12–16 GB of RAM.
7
7
 
8
- **Version: `0.50.2.dev8`** · import name is unchanged (`import bitsandbytes as bnb`) · MIT.
8
+ **Version: `0.50.2.dev9`** · import name is unchanged (`import bitsandbytes as bnb`) · MIT.
9
9
 
10
10
  What the CPU backend provides: 8-bit blockwise optimizers (≈2.3 bytes of state per parameter
11
11
  instead of 8; the 4-bit optimizer ≈1.03), 4/8-bit layers that run on CPU tensors, the fused
@@ -171,7 +171,7 @@ Also: `estimate_training_memory_gb()`, `spawn_training_jobs(cmds, plan)` (logs p
171
171
  | Area | What it does |
172
172
  |---|---|
173
173
  | 8-bit optimizers | AdamW/Adam/AdEMAMix/LAMB/LARS/Lion + paged variants, blockwise 8-bit state with single-pass dequant→update→requant kernels (AVX2/NEON) |
174
- | 4-bit optimizer | `AdamW4bit`: ≈1.03 bytes of state per parameter (restored in dev8; scalar kernel + torch fallback) |
174
+ | 4-bit optimizer | `AdamW4bit`: ≈1.03 bytes of state per parameter (scalar kernel; native on Linux and, since dev9, Windows) |
175
175
  | Quantisation | blockwise 8-bit, NF4/FP4 4-bit quantize/dequantize; 4-bit GEMV inference kernel |
176
176
  | `gemm_8bit` | `out = A @ dequant8(B)` with weights kept uint8 (¼ DRAM traffic), no fp32 temporary (`bnb.functional.fused_dequant_linear_8bit`) |
177
177
  | GDN | fused Gated DeltaNet forward + chunk-checkpointed backward (`gdn_fwd_cpu` / `gdn_bwd_cpu`), plus `patch_transformers()` / `patch_fla()` |
@@ -184,6 +184,48 @@ The library never loads a CUDA/ROCm/XPU library: `bnb.cuda`/`bnb.optim` CPU path
184
184
 
185
185
  ---
186
186
 
187
+ ## Full fine-tuning vs LoRA
188
+
189
+ `--mode full` (and `bnb.optim.*` directly) fine-tunes **every parameter**; measured on
190
+ Qwen3.5-0.8B (752 M, 100% trainable, fp32 + AdamW8bit, seq 64, batch 1): **peak RSS
191
+ 10.4 GB, 8.8 s/step**, versus LoRA (5.4 M trainable) at **5.9 GB / 2.65 s/step**. On a
192
+ 15.4 GB machine ~0.8 B full fine-tuning is comfortable; ~1 B is tight (estimator:
193
+ 10.7 GB weights+grads+8-bit state before activations), and above that use LoRA / EFST /
194
+ q3bit, or add activation checkpointing (not yet wired into the generic trainer).
195
+
196
+ ## iGPU image inference (experimental)
197
+
198
+ The OpenCL kit is GEMM-oriented (`nn.Linear`/`Conv1D`); diffusion UNets are conv2d-heavy and
199
+ need an im2col+dGEMM conv engine before the OpenCL path can run them. As a proof of concept,
200
+ `gt1030/igpu_image_ort.py` runs an ONNX-exported SD1.5 through ONNX Runtime's
201
+ **DmlExecutionProvider** on the integrated GPU (local `_sd15_combined`, 256x256, DDIM):
202
+
203
+ | path | 8 steps | per step |
204
+ |---|---|---|
205
+ | CPU diffusers (Torch 2.13, 6 threads) | 25.29 s | 3.16 s |
206
+ | **iGPU ONNX Runtime DirectML** | **13.05 s** | **1.63 s** |
207
+
208
+ ≈**1.9x** faster at 256x256; 512x512 currently fails inside the UNet on the DML EP (activation
209
+ memory / operator coverage) while the same ONNX runs on `CPUExecutionProvider`. Export once with
210
+ `optimum-cli export onnx --task stable-diffusion --opset 17`. A diffusers + `torch_directml`
211
+ variant (`igpu_image_infer.py`) is kept as a comparison; it needs legacy attention and still hits
212
+ DML `chunk`/reshape issues. Long-term the OpenCL backend gets an **fp16 device-resident conv engine**: measured probes
213
+ show per-op OpenCL conv is 2-3x slower than CPU oneDNN and fp32 resident only reaches parity,
214
+ but fp16 resident im2col+Hgemm is **1.3-2x faster than the CPU conv** at SD1.5 shapes
215
+ (538 vs 342 GFLOPS; 1280-channel 16x16 layer 17.3 vs 34.8 ms). The 256-resolution demo
216
+ therefore uses DirectML, while the OpenCL engine is the planned production backend.
217
+
218
+ The fp16 device-resident building blocks are in `gt1030/opencl_fp16_ops.py` +
219
+ `gt1030/kernels_attention.cl` (im2col + CLBlast Hgemm conv, GroupNorm+SiLU, LayerNorm,
220
+ GEGLU, multi-head attention, nearest-2x upsample, add). Clean measurements on the
221
+ Vega 6 (no CPU contention), parity 0.02-1.1% relL2:
222
+ ResNetBlock2D 0.61-0.77x, VAE up-block 0.40x, FFN 0.16-0.23x, attention 0.42-0.99x,
223
+ full Transformer block 0.51-0.71x of CPU time -- i.e. 1.3-6x faster for most blocks.
224
+ The **VAE decoder is now end-to-end on the iGPU** (`gt1030/opencl_vae.py`): fp16 parity
225
+ 2.7-3.7% vs CPU, 1.81 s vs 2.07 s at 256 (0.87x), 7.93 s vs 8.34 s at 512 (0.95x, warm).
226
+ The remaining step is assembling the full 256px UNet graph (fp16 weights ~1.7 GB,
227
+ under the 5,090 MB single-allocation limit; 512px needs activation tiling).
228
+
187
229
  ## 3-bit frozen base + LoRA (`bitsandbytes.q3bit`, experimental)
188
230
 
189
231
  A frozen weight can be stored as blockwise **3-bit** codes (≈11% of fp32 memory) and
@@ -225,6 +267,8 @@ R5-4500U (6C/6T, AVX2, 15.4 GB) / i5-10400 (6C/12T, AVX2, 12 GB), no NVIDIA GPU.
225
267
  | Concurrency packing (synthetic jobs) | 6 jobs × 1 thread **5619 tok/s** vs 1 job × 6 threads **3843 tok/s** (+46%) |
226
268
  | Real model (Qwen3.5-0.8B LoRA, seq 64) | 4 threads beat 6 by **7–10%** — measure with `tune_threads()` |
227
269
  | Fused lm_head 3-bit GEMM (research) | 14–22% faster than fp32 matmul, 89% less weight memory |
270
+ | 3-bit frozen base + LoRA (Qwen3-1.7B, CPU) | 80 steps: eval loss 4.34 → **4.03**; RSS **2.9 GB vs 8.7 GB** fp32; step 7.7 s vs 5.5 s (native Windows) |
271
+ | Full-parameter fine-tune (Qwen3.5-0.8B, 752 M, fp32 + AdamW8bit, CPU) | **10.4 GB peak RSS**, 8.8 s/step; LoRA on the same model: 5.9 GB, 2.65 s/step |
228
272
  | AdamW4bit step (1M params) | 28.6 ms vs 3.3 ms for the AVX2 8-bit kernel; state 1.031 vs 2.062 B/param |
229
273
 
230
274
  Not every workload is faster than fp32: 4-bit/8-bit kernels trade compute for memory traffic,
@@ -236,14 +280,15 @@ the full trade-off tables, including negative results.
236
280
  ## Platform limitations
237
281
 
238
282
  - **CPU only.** CUDA/ROCm/XPU kernels are not built; a GPU is never required or used.
239
- - **Windows wheel** ships a prebuilt DLL. That DLL predates the dev5/dev6 2/3-bit
240
- kernels and the restored 4-bit optimizer kernel, so those run the pure-torch
241
- fallback there (same numbers, lower speed).
283
+ - **Windows wheel**: from dev9 on it ships the MSVC DLL built by CI from the current
284
+ `csrc`, which exports the 2/3-bit dequant/GEMM and 4-bit optimizer kernels; they run
285
+ natively on Windows (verified: dequant maxdiff 1.2e-6, 4-bit native vs torch 1.2e-7).
286
+ Wheels older than dev9 fall back to pure torch for those symbols.
242
287
  - **manylinux_2_17 wheel**: the AVX-512 library inside it is single-threaded (the parallel
243
288
  build is only for the native `manylinux_2_39` wheel). On AVX-512 machines set
244
289
  `BNB_CPU_DISABLE_AVX512=1` to run the AVX2 OpenMP path.
245
- - **aarch64**: there is no PyPI wheel yet; build from the sdist (`build_linux.sh`) or use the
246
- Termux instructions in `docs_cpu/TERMUX_GUIDE.md`.
290
+ - **aarch64**: there is no PyPI wheel yet; build from the sdist (`build_linux.sh`) or follow the
291
+ Termux guide [`TERMUX_GUIDE.md`](https://github.com/Ganyvnanoaa09-0906/bitsandbytes-CPU/blob/HEAD/bitsandbytes/TERMUX_GUIDE.md).
247
292
  - **macOS**: no wheel is published and the CPU backend is not tested there; the sdist build may
248
293
  work with clang + OpenMP, but treat it as unsupported.
249
294
  - 3-bit (and 2-bit dequant-only) is **experimental**: the API and kernels are covered
@@ -262,6 +307,23 @@ bash build_linux.sh --selftest # also build + run the torch-free C se
262
307
  build_manual\build_manual.bat amd # run inside "x64 Native Tools Command Prompt"
263
308
  ```
264
309
 
310
+ ### Termux (Android / ARM64)
311
+
312
+ On-device builds work; there is no aarch64 PyPI wheel, so build from the sdist:
313
+
314
+ ```bash
315
+ pkg update && pkg install -y clang libomp make python
316
+ bash build_termux.sh # -> bitsandbytes/libbitsandbytes_cpu.so
317
+ bash build_termux.sh --selftest # also build + run the torch-free C self-test
318
+ ```
319
+
320
+ Three Termux-specific traps the script already handles: the compiler is `clang++` (there is no
321
+ `g++`), OpenMP needs `pkg install libomp`, and `-march=native` is unsafe under Android's clang.
322
+ The script is also what the automated flow uses to build on a phone **driven from a PC over ADB**
323
+ — see [`TERMUX_GUIDE.md`](https://github.com/Ganyvnanoaa09-0906/bitsandbytes-CPU/blob/HEAD/bitsandbytes/TERMUX_GUIDE.md)
324
+ for the phone-side preparation, the ADB/wireless-debugging path, the ARM64 kernel notes and the
325
+ verification matrix.
326
+
265
327
  Two special wheel builds used by this project are documented in
266
328
  [`docs_cpu/WHEEL_PLATFORM_NOTES.md`](https://github.com/Ganyvnanoaa09-0906/bitsandbytes-CPU/blob/HEAD/bitsandbytes/docs_cpu/WHEEL_PLATFORM_NOTES.md):
267
329
  the zig manylinux_2_17 portable build and the devtoolset-8 manylinux_2_17 **OpenMP** build
@@ -303,6 +365,7 @@ The long-form docs live in the repository (`bitsandbytes/docs_cpu/`, Chinese and
303
365
  | `0.50.2.dev6` | manylinux_2_17 wheel is now **OpenMP** (devtoolset-8, bundled libgomp → 3–4× optimizer-kernel speedup on old glibc); csrc 2/3-bit dequant + fused GEMM kernels with 9-item C self-test; EFST fused tensor-expert routing fix; GCC 8 `<cpuid.h>` portability fix |
304
366
  | `0.50.2.dev7` | documentation release: README rewritten for the CPU fork (install/wheels/platform matrix, feature table, measured performance, limitations, tests, full dev1→dev7 changelog, EFST/disk-balancer/toolbox examples) |
305
367
  | `0.50.2.dev8` | **restored `AdamW4bit`** (the kernel was dropped when dev4 vendored upstream; now scalar C kernel + torch fallback, 1.031 B/param); **new `bitsandbytes.q3bit` API** — `quantize_3bit`/`dequantize_3bit`/`gemm_3bit`/`gemm_3bit_transposed`, `QuantLinear3bit` (frozen 3-bit base + LoRA), `convert_linears_3bit`, native kernels on Linux with identical pure-torch fallback; CLI reference now includes 4bitopt/q3bit and all 43 examples execute in CI-style verification |
368
+ | `0.50.2.dev9` | **Windows native kernels**: CI now compiles the MSVC DLL from the current csrc and the export list includes the 4-bit optimizer and 2/3-bit symbols (they were silently missing before); **q3bit real-model validation** on Qwen3-1.7B (frozen 3-bit base + LoRA, eval 4.34→4.03 over 80 steps, RSS −67%, native step 7.7 s vs fp32 5.5 s); fixed the causal-LM **double-shift** label bug in the iGPU training kit (Windows package v0.1.2) |
306
369
 
307
370
  ## License and attribution
308
371
 
@@ -1,84 +1,84 @@
1
- # Copyright (c) Facebook, Inc. and its affiliates.
2
- #
3
- # This source code is licensed under the MIT license found in the
4
- # LICENSE file in the root directory of this source tree.
5
-
6
-
7
- import importlib
8
- import sys
9
-
10
- import torch
11
-
12
- from . import _ops, utils
13
- from .autograd._functions import (
14
- MatmulLtState,
15
- matmul,
16
- matmul_4bit,
17
- )
18
- from .backends.cpu import ops as cpu_ops
19
- from .backends.default import ops as default_ops
20
- from .nn import modules
21
- from .optim import adam
22
-
23
- # This is a signal for integrations with transformers/diffusers.
24
- # Eventually we may remove this but it is currently required for compatibility.
25
- features = {"multi_backend"}
26
- supported_torch_devices = {
27
- "cpu",
28
- "cuda", # NVIDIA/AMD GPU
29
- "xpu", # Intel GPU
30
- "hpu", # Intel Gaudi
31
- "npu", # Ascend NPU
32
- "mps", # Apple Silicon
33
- }
34
-
35
- if torch.cuda.is_available():
36
- from .backends.cuda import ops as cuda_ops
37
-
38
- if hasattr(torch, "xpu") and torch.xpu.is_available():
39
- from .backends.xpu import ops as xpu_ops
40
-
41
- if hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
42
- from .backends.mps import ops as mps_ops
43
-
44
- if importlib.util.find_spec("habana_frameworks") and importlib.util.find_spec("habana_frameworks.torch"):
45
- # In case not automatically imported
46
- import habana_frameworks.torch
47
-
48
- if hasattr(torch, "hpu") and torch.hpu.is_available():
49
- from .backends.hpu import ops as hpu_ops
50
-
51
-
52
- def _import_backends():
53
- """
54
- Discover and autoload all available backends installed as separate packages.
55
- Packages with an entrypoint for "bitsandbytes.backends" will be loaded.
56
- Inspired by PyTorch implementation: https://pytorch.org/tutorials/prototype/python_extension_autoload.html
57
- """
58
- from importlib.metadata import entry_points
59
-
60
- extensions = entry_points(group="bitsandbytes.backends")
61
-
62
- for ext in extensions:
63
- try:
64
- entry = ext.load()
65
- entry()
66
- except Exception as e:
67
- raise RuntimeError(f"bitsandbytes: failed to load backend {ext.name}: {e}") from e
68
-
69
-
70
- _import_backends()
71
-
72
- __pdoc__ = {
73
- "libbitsandbytes": False,
74
- "optim.optimizer.Optimizer8bit": False,
75
- "optim.optimizer.MockArgs": False,
76
- }
77
-
78
- __version__ = "0.50.2.dev8"
79
-
80
- # 挂载 gdn_cpu(GDN 融合内核 / patch_transformers 入口),让 bnb.gdn_cpu 可直接访问
81
- from . import gdn_cpu # noqa: E402,F401
82
-
83
- # 挂载 q3bit(实验性 2/3-bit 量化 / 冻结 3-bit base + LoRA),让 bnb.q3bit 可直接访问
84
- from . import q3bit # noqa: E402,F401
1
+ # Copyright (c) Facebook, Inc. and its affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+
7
+ import importlib
8
+ import sys
9
+
10
+ import torch
11
+
12
+ from . import _ops, utils
13
+ from .autograd._functions import (
14
+ MatmulLtState,
15
+ matmul,
16
+ matmul_4bit,
17
+ )
18
+ from .backends.cpu import ops as cpu_ops
19
+ from .backends.default import ops as default_ops
20
+ from .nn import modules
21
+ from .optim import adam
22
+
23
+ # This is a signal for integrations with transformers/diffusers.
24
+ # Eventually we may remove this but it is currently required for compatibility.
25
+ features = {"multi_backend"}
26
+ supported_torch_devices = {
27
+ "cpu",
28
+ "cuda", # NVIDIA/AMD GPU
29
+ "xpu", # Intel GPU
30
+ "hpu", # Intel Gaudi
31
+ "npu", # Ascend NPU
32
+ "mps", # Apple Silicon
33
+ }
34
+
35
+ if torch.cuda.is_available():
36
+ from .backends.cuda import ops as cuda_ops
37
+
38
+ if hasattr(torch, "xpu") and torch.xpu.is_available():
39
+ from .backends.xpu import ops as xpu_ops
40
+
41
+ if hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
42
+ from .backends.mps import ops as mps_ops
43
+
44
+ if importlib.util.find_spec("habana_frameworks") and importlib.util.find_spec("habana_frameworks.torch"):
45
+ # In case not automatically imported
46
+ import habana_frameworks.torch
47
+
48
+ if hasattr(torch, "hpu") and torch.hpu.is_available():
49
+ from .backends.hpu import ops as hpu_ops
50
+
51
+
52
+ def _import_backends():
53
+ """
54
+ Discover and autoload all available backends installed as separate packages.
55
+ Packages with an entrypoint for "bitsandbytes.backends" will be loaded.
56
+ Inspired by PyTorch implementation: https://pytorch.org/tutorials/prototype/python_extension_autoload.html
57
+ """
58
+ from importlib.metadata import entry_points
59
+
60
+ extensions = entry_points(group="bitsandbytes.backends")
61
+
62
+ for ext in extensions:
63
+ try:
64
+ entry = ext.load()
65
+ entry()
66
+ except Exception as e:
67
+ raise RuntimeError(f"bitsandbytes: failed to load backend {ext.name}: {e}") from e
68
+
69
+
70
+ _import_backends()
71
+
72
+ __pdoc__ = {
73
+ "libbitsandbytes": False,
74
+ "optim.optimizer.Optimizer8bit": False,
75
+ "optim.optimizer.MockArgs": False,
76
+ }
77
+
78
+ __version__ = "0.50.2.dev10"
79
+
80
+ # 挂载 gdn_cpu(GDN 融合内核 / patch_transformers 入口),让 bnb.gdn_cpu 可直接访问
81
+ from . import gdn_cpu # noqa: E402,F401
82
+
83
+ # 挂载 q3bit(实验性 2/3-bit 量化 / 冻结 3-bit base + LoRA),让 bnb.q3bit 可直接访问
84
+ from . import q3bit # noqa: E402,F401
@@ -1,4 +1,4 @@
1
- if __name__ == "__main__":
2
- from bitsandbytes.diagnostics.main import main
3
-
4
- main()
1
+ if __name__ == "__main__":
2
+ from bitsandbytes.diagnostics.main import main
3
+
4
+ main()