bitsandbytes-cpu-fork 0.50.2.dev0__tar.gz → 0.50.2.dev1__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 (149) hide show
  1. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/MANIFEST.in +11 -0
  2. {bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes_cpu_fork.egg-info → bitsandbytes_cpu_fork-0.50.2.dev1}/PKG-INFO +88 -11
  3. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/README.md +86 -8
  4. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/__init__.py +1 -1
  5. bitsandbytes_cpu_fork-0.50.2.dev1/bitsandbytes/cli.py +50 -0
  6. bitsandbytes_cpu_fork-0.50.2.dev1/bitsandbytes/detect_cpu.py +189 -0
  7. bitsandbytes_cpu_fork-0.50.2.dev1/bitsandbytes/disk_balancer.py +1224 -0
  8. bitsandbytes_cpu_fork-0.50.2.dev1/bitsandbytes/torch_cpu_kit.py +468 -0
  9. bitsandbytes_cpu_fork-0.50.2.dev1/bitsandbytes_cpu_cli.py +949 -0
  10. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1/bitsandbytes_cpu_fork.egg-info}/PKG-INFO +88 -11
  11. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes_cpu_fork.egg-info/SOURCES.txt +19 -9
  12. bitsandbytes_cpu_fork-0.50.2.dev1/bitsandbytes_cpu_fork.egg-info/entry_points.txt +3 -0
  13. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes_cpu_fork.egg-info/requires.txt +1 -2
  14. bitsandbytes_cpu_fork-0.50.2.dev1/bitsandbytes_cpu_fork.egg-info/top_level.txt +2 -0
  15. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/build_linux.sh +7 -1
  16. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/cpu_cache.h +241 -198
  17. bitsandbytes_cpu_fork-0.50.2.dev1/docs_cpu/API_REFERENCE.md +582 -0
  18. bitsandbytes_cpu_fork-0.50.2.dev1/docs_cpu/API_REFERENCE_EN.md +581 -0
  19. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/docs_cpu/QUICKSTART.md +20 -2
  20. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/docs_cpu/QUICKSTART_EN.md +30 -0
  21. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/pyproject.toml +43 -2
  22. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/setup.py +78 -12
  23. bitsandbytes_cpu_fork-0.50.2.dev1/tests/test_cpu_e2e.py +201 -0
  24. bitsandbytes_cpu_fork-0.50.2.dev1/tools/dump_signatures.py +64 -0
  25. bitsandbytes_cpu_fork-0.50.2.dev1/tools/gen_api_reference.py +43 -0
  26. bitsandbytes_cpu_fork-0.50.2.dev1/tools/sector_carve.c +392 -0
  27. bitsandbytes_cpu_fork-0.50.2.dev1/tools/sector_carve_gui.c +555 -0
  28. bitsandbytes_cpu_fork-0.50.2.dev1/tools/sector_mirror.c +285 -0
  29. bitsandbytes_cpu_fork-0.50.2.dev1/tools/sector_mirror_gui.c +530 -0
  30. bitsandbytes_cpu_fork-0.50.2.dev1/tools/train_llm_sft.py +111 -0
  31. bitsandbytes_cpu_fork-0.50.2.dev1/tools/verify_help_examples.py +213 -0
  32. bitsandbytes_cpu_fork-0.50.2.dev1/tools/verify_linux_cli.sh +115 -0
  33. bitsandbytes_cpu_fork-0.50.2.dev1/tools/verify_train_release.py +90 -0
  34. bitsandbytes_cpu_fork-0.50.2.dev0/bitsandbytes_cpu_fork.egg-info/top_level.txt +0 -1
  35. bitsandbytes_cpu_fork-0.50.2.dev0/build_manual/bench_amd.exe +0 -0
  36. bitsandbytes_cpu_fork-0.50.2.dev0/build_manual/export.def.bak +0 -27
  37. bitsandbytes_cpu_fork-0.50.2.dev0/build_manual/selftest_cpu.exe +0 -0
  38. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/cpu_ops.cpp.bak +0 -2973
  39. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/cpu_ops.h.bak +0 -502
  40. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/pythonInterface.cpp.bak +0 -923
  41. bitsandbytes_cpu_fork-0.50.2.dev0/csrc/test_cpu_cache.exe +0 -0
  42. bitsandbytes_cpu_fork-0.50.2.dev0/docs_cpu/__pycache__/check_docs.cpython-311.pyc +0 -0
  43. bitsandbytes_cpu_fork-0.50.2.dev0/tests/test_cpu_e2e.py +0 -93
  44. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/LICENSE +0 -0
  45. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/__main__.py +0 -0
  46. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/_ops.py +0 -0
  47. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/autograd/__init__.py +0 -0
  48. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/autograd/_functions.py +0 -0
  49. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/__init__.py +0 -0
  50. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/cpu/__init__.py +0 -0
  51. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/cpu/ops.py +0 -0
  52. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/cuda/__init__.py +0 -0
  53. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/cuda/ops.py +0 -0
  54. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/default/__init__.py +0 -0
  55. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/default/ops.py +0 -0
  56. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/hpu/__init__.py +0 -0
  57. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/hpu/ops.py +0 -0
  58. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/mps/__init__.py +0 -0
  59. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/mps/ops.py +0 -0
  60. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/triton/__init__.py +0 -0
  61. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/triton/kernels_4bit.py +0 -0
  62. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/triton/kernels_8bit_quant.py +0 -0
  63. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/triton/kernels_optim.py +0 -0
  64. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/triton/ops.py +0 -0
  65. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/utils.py +0 -0
  66. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/xpu/__init__.py +0 -0
  67. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/backends/xpu/ops.py +0 -0
  68. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/cextension.py +0 -0
  69. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/consts.py +0 -0
  70. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/cuda_specs.py +0 -0
  71. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/diagnostics/__init__.py +0 -0
  72. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/diagnostics/cuda.py +0 -0
  73. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/diagnostics/main.py +0 -0
  74. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/diagnostics/utils.py +0 -0
  75. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/functional.py +0 -0
  76. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/gdn_cpu.py +0 -0
  77. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/libbitsandbytes_cpu.dll +0 -0
  78. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/nn/__init__.py +0 -0
  79. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/nn/modules.py +0 -0
  80. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/nn/parametrize.py +0 -0
  81. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/optim/__init__.py +0 -0
  82. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/optim/adagrad.py +0 -0
  83. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/optim/adam.py +0 -0
  84. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/optim/adamw.py +0 -0
  85. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/optim/ademamix.py +0 -0
  86. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/optim/lamb.py +0 -0
  87. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/optim/lars.py +0 -0
  88. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/optim/lion.py +0 -0
  89. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/optim/optimizer.py +0 -0
  90. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/optim/rmsprop.py +0 -0
  91. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/optim/sgd.py +0 -0
  92. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/py.typed +0 -0
  93. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes/utils.py +0 -0
  94. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/bitsandbytes_cpu_fork.egg-info/dependency_links.txt +0 -0
  95. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/build_manual/build_aggressive.log +0 -0
  96. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/build_manual/build_manual.bat +0 -0
  97. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/build_manual/export.def +0 -0
  98. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/build_manual/selftest_win.bat +0 -0
  99. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/build_termux.sh +0 -0
  100. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/avx2_gemv_4bit.h +0 -0
  101. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/common.cuh +0 -0
  102. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/common.h +0 -0
  103. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/compat.cuh +0 -0
  104. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/compat_device.cuh +0 -0
  105. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/cpu_gdn.cpp +0 -0
  106. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/cpu_ops.cpp +0 -0
  107. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/cpu_ops.h +0 -0
  108. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/gemm_4bit.cu +0 -0
  109. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/gemm_4bit_common.cuh +0 -0
  110. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/gemm_4bit_mma.cuh +0 -0
  111. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/gemm_4bit_simt.cu +0 -0
  112. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/gemm_4bit_simt.cuh +0 -0
  113. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/gemm_4bit_sm75.cu +0 -0
  114. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/gemm_4bit_sm75.cuh +0 -0
  115. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/gemm_4bit_sm80.cu +0 -0
  116. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/gemm_4bit_sm80.cuh +0 -0
  117. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/kernels.cu +0 -0
  118. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/kernels.cuh +0 -0
  119. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/ops.cu +0 -0
  120. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/ops.cuh +0 -0
  121. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/pythonInterface.cpp +0 -0
  122. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/test_avx2_gemv_4bit.cpp +0 -0
  123. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/test_cpu_cache.cpp +0 -0
  124. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/xpu_kernels.cpp +0 -0
  125. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/xpu_kernels.h +0 -0
  126. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/xpu_ops.cpp +0 -0
  127. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/csrc/xpu_ops.h +0 -0
  128. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/docs_cpu/TECHNICAL_GUIDE.md +0 -0
  129. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/docs_cpu/TECHNICAL_GUIDE_EN.md +0 -0
  130. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/docs_cpu/TECH_REPORT.md +0 -0
  131. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/docs_cpu/TECH_REPORT_EN.md +0 -0
  132. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/docs_cpu/check_docs.py +0 -0
  133. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/examples/compile_inference.py +0 -0
  134. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/examples/cpu/cpu_training.py +0 -0
  135. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/examples/int8_inference_huggingface.py +0 -0
  136. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/examples/xpu/benchmark_paged_memory.py +0 -0
  137. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/examples/xpu/paged_xpu_training.py +0 -0
  138. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/selftest_cpu.c +0 -0
  139. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/setup.cfg +0 -0
  140. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/tests/test_autograd.py +0 -0
  141. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/tests/test_cuda_setup_evaluator.py +0 -0
  142. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/tests/test_functional.py +0 -0
  143. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/tests/test_generation.py +0 -0
  144. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/tests/test_linear4bit.py +0 -0
  145. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/tests/test_linear8bitlt.py +0 -0
  146. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/tests/test_modules.py +0 -0
  147. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/tests/test_ops.py +0 -0
  148. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/tests/test_optim.py +0 -0
  149. {bitsandbytes_cpu_fork-0.50.2.dev0 → bitsandbytes_cpu_fork-0.50.2.dev1}/tests/test_parametrize.py +0 -0
@@ -17,6 +17,17 @@ graft csrc
17
17
  graft build_manual
18
18
  graft docs_cpu
19
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
20
31
  include build_linux.sh
21
32
  include build_termux.sh
22
33
  include selftest_cpu.c
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitsandbytes-cpu-fork
3
- Version: 0.50.2.dev0
3
+ Version: 0.50.2.dev1
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
@@ -22,14 +22,93 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
22
  Requires-Python: >=3.10
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
- Requires-Dist: torch<3,>=2.4
26
25
  Requires-Dist: numpy>=1.17
27
26
  Requires-Dist: packaging>=20.9
27
+ Requires-Dist: psutil>=5.9
28
28
  Provides-Extra: test
29
29
  Requires-Dist: pytest~=8.3; extra == "test"
30
- Requires-Dist: psutil>=5.9; extra == "test"
31
30
  Dynamic: license-file
32
31
 
32
+ > **This is the CPU fork** — `bitsandbytes-cpu-fork`, not upstream `bitsandbytes`.
33
+ > It replaces the CUDA kernels with a pure-CPU backend (AVX2 on x86-64, NEON on ARM64):
34
+ > 8-bit optimizers, fused Gated DeltaNet, `gemm_8bit`, block-wise 4/8-bit quantisation.
35
+ > No GPU, no CUDA toolkit, no NVIDIA driver. Full guide:
36
+ > [`docs_cpu/QUICKSTART.md`](docs_cpu/QUICKSTART.md) (中文) ·
37
+ > [`docs_cpu/QUICKSTART_EN.md`](docs_cpu/QUICKSTART_EN.md).
38
+
39
+ ## Install
40
+
41
+ **`torch` is deliberately not a dependency.** On PyPI the name `torch` resolves to the
42
+ CUDA build, so declaring it made this CPU-only library download roughly 2.5 GB of
43
+ `nvidia-*` wheels — cublas, cudnn, nccl, nvshmem and thirteen more — onto machines with
44
+ no NVIDIA device at all. Measured on a clean Ubuntu install. `install_requires` cannot
45
+ express "the CPU build", because that lives on a different index, so install it first:
46
+
47
+ ```bash
48
+ pip install torch --index-url https://download.pytorch.org/whl/cpu
49
+ pip install bitsandbytes-cpu-fork
50
+ ```
51
+
52
+ ### Windows
53
+
54
+ A wheel is published with the CPU library already built in, so no compiler and no
55
+ Visual C++ Redistributable are needed:
56
+
57
+ ```bat
58
+ pip install bitsandbytes-cpu-fork
59
+ ```
60
+
61
+ ### Linux
62
+
63
+ Only the source distribution is published. `pip` builds it, and `setup.py` runs
64
+ `build_linux.sh` for you, so the library is compiled against your own glibc rather than
65
+ shipped prebuilt. That needs a C++ compiler with OpenMP:
66
+
67
+ ```bash
68
+ sudo apt install g++ libomp-dev # Debian / Ubuntu
69
+ sudo dnf install gcc-c++ libomp-devel # Fedora / RHEL
70
+ sudo pacman -S gcc openmp # Arch
71
+ ```
72
+
73
+ If the toolchain is missing the build **stops and names that command**, rather than
74
+ producing a wheel that installs cleanly and then fails at `import bitsandbytes`.
75
+
76
+ To build by hand instead, or to check the kernels without torch:
77
+
78
+ ```bash
79
+ bash build_linux.sh --selftest
80
+ ```
81
+
82
+ ### Verify the install
83
+
84
+ ```bash
85
+ python -m bitsandbytes
86
+ ```
87
+
88
+ ### Then ask it what it can do
89
+
90
+ `pip` installs a `bitsandbytes-cpu` command (also available as `bnb-cpu`). It is the
91
+ reference for this fork: what the hardware is, whether the kernels load, and **how to
92
+ call every feature it adds** — each entry carries the exact call, and every Python
93
+ example in it is executed before release.
94
+
95
+ ```bash
96
+ bitsandbytes-cpu detect # CPU model, cores, SIMD, RAM, recommended thread count
97
+ bitsandbytes-cpu selftest # runs a 4-bit layer, an 8-bit optimizer step, the GDN kernel
98
+ bitsandbytes-cpu help # the whole reference
99
+ bitsandbytes-cpu help 8bitopt # one section: the 8-bit optimizer
100
+ bitsandbytes-cpu help 4bit # one section: 4-bit layers on a CPU
101
+ bitsandbytes-cpu help kernels # one section: the fused kernels, called directly
102
+ bitsandbytes-cpu doctor # which .dll/.so will load, and which symbols it has
103
+ ```
104
+
105
+ Section keys: `intro start 4bit qlora 8bitopt kernels toolkit threads memory gdn disks
106
+ layers optim functional notes`. The same tables are published as
107
+ [`docs_cpu/API_REFERENCE.md`](docs_cpu/API_REFERENCE.md)
108
+ ([English](docs_cpu/API_REFERENCE_EN.md)).
109
+
110
+ ---
111
+
33
112
  <p align="center"><img src="https://avatars.githubusercontent.com/u/175231607?s=200&v=4" alt=""></p>
34
113
  <h1 align="center">bitsandbytes</h1>
35
114
  <p align="center">
@@ -238,20 +317,18 @@ extensions make pure-CPU LoRA / quantization / diffusion training practical.
238
317
 
239
318
  ### Install (Windows, no compiler needed)
240
319
 
241
- The wheel bundles the prebuilt CPU kernel and its OpenMP runtime, so nothing has to
242
- be built after installing:
243
-
244
320
  ```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
321
+ pip install bitsandbytes-cpu-fork
246
322
  ```
247
323
 
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:
324
+ The wheel bundles the prebuilt CPU kernel and its OpenMP runtime, so nothing has to
325
+ be built after installing; `pip` pulls `torch` and `numpy` itself. One wheel covers
326
+ every Python 3 version on 64-bit Windows. The import name is unchanged, so existing
327
+ code and the Transformers / PEFT / Diffusers integrations keep working as-is:
251
328
 
252
329
  ```python
253
330
  import bitsandbytes as bnb # the fork, not upstream
254
- print(bnb.__version__) # 0.50.2.dev0
331
+ print(bnb.__version__) # 0.50.2.dev1
255
332
  ```
256
333
 
257
334
  Building from source instead (any platform) is described in
@@ -1,3 +1,83 @@
1
+ > **This is the CPU fork** — `bitsandbytes-cpu-fork`, not upstream `bitsandbytes`.
2
+ > It replaces the CUDA kernels with a pure-CPU backend (AVX2 on x86-64, NEON on ARM64):
3
+ > 8-bit optimizers, fused Gated DeltaNet, `gemm_8bit`, block-wise 4/8-bit quantisation.
4
+ > No GPU, no CUDA toolkit, no NVIDIA driver. Full guide:
5
+ > [`docs_cpu/QUICKSTART.md`](docs_cpu/QUICKSTART.md) (中文) ·
6
+ > [`docs_cpu/QUICKSTART_EN.md`](docs_cpu/QUICKSTART_EN.md).
7
+
8
+ ## Install
9
+
10
+ **`torch` is deliberately not a dependency.** On PyPI the name `torch` resolves to the
11
+ CUDA build, so declaring it made this CPU-only library download roughly 2.5 GB of
12
+ `nvidia-*` wheels — cublas, cudnn, nccl, nvshmem and thirteen more — onto machines with
13
+ no NVIDIA device at all. Measured on a clean Ubuntu install. `install_requires` cannot
14
+ express "the CPU build", because that lives on a different index, so install it first:
15
+
16
+ ```bash
17
+ pip install torch --index-url https://download.pytorch.org/whl/cpu
18
+ pip install bitsandbytes-cpu-fork
19
+ ```
20
+
21
+ ### Windows
22
+
23
+ A wheel is published with the CPU library already built in, so no compiler and no
24
+ Visual C++ Redistributable are needed:
25
+
26
+ ```bat
27
+ pip install bitsandbytes-cpu-fork
28
+ ```
29
+
30
+ ### Linux
31
+
32
+ Only the source distribution is published. `pip` builds it, and `setup.py` runs
33
+ `build_linux.sh` for you, so the library is compiled against your own glibc rather than
34
+ shipped prebuilt. That needs a C++ compiler with OpenMP:
35
+
36
+ ```bash
37
+ sudo apt install g++ libomp-dev # Debian / Ubuntu
38
+ sudo dnf install gcc-c++ libomp-devel # Fedora / RHEL
39
+ sudo pacman -S gcc openmp # Arch
40
+ ```
41
+
42
+ If the toolchain is missing the build **stops and names that command**, rather than
43
+ producing a wheel that installs cleanly and then fails at `import bitsandbytes`.
44
+
45
+ To build by hand instead, or to check the kernels without torch:
46
+
47
+ ```bash
48
+ bash build_linux.sh --selftest
49
+ ```
50
+
51
+ ### Verify the install
52
+
53
+ ```bash
54
+ python -m bitsandbytes
55
+ ```
56
+
57
+ ### Then ask it what it can do
58
+
59
+ `pip` installs a `bitsandbytes-cpu` command (also available as `bnb-cpu`). It is the
60
+ reference for this fork: what the hardware is, whether the kernels load, and **how to
61
+ call every feature it adds** — each entry carries the exact call, and every Python
62
+ example in it is executed before release.
63
+
64
+ ```bash
65
+ bitsandbytes-cpu detect # CPU model, cores, SIMD, RAM, recommended thread count
66
+ bitsandbytes-cpu selftest # runs a 4-bit layer, an 8-bit optimizer step, the GDN kernel
67
+ bitsandbytes-cpu help # the whole reference
68
+ bitsandbytes-cpu help 8bitopt # one section: the 8-bit optimizer
69
+ bitsandbytes-cpu help 4bit # one section: 4-bit layers on a CPU
70
+ bitsandbytes-cpu help kernels # one section: the fused kernels, called directly
71
+ bitsandbytes-cpu doctor # which .dll/.so will load, and which symbols it has
72
+ ```
73
+
74
+ Section keys: `intro start 4bit qlora 8bitopt kernels toolkit threads memory gdn disks
75
+ layers optim functional notes`. The same tables are published as
76
+ [`docs_cpu/API_REFERENCE.md`](docs_cpu/API_REFERENCE.md)
77
+ ([English](docs_cpu/API_REFERENCE_EN.md)).
78
+
79
+ ---
80
+
1
81
  <p align="center"><img src="https://avatars.githubusercontent.com/u/175231607?s=200&v=4" alt=""></p>
2
82
  <h1 align="center">bitsandbytes</h1>
3
83
  <p align="center">
@@ -206,20 +286,18 @@ extensions make pure-CPU LoRA / quantization / diffusion training practical.
206
286
 
207
287
  ### Install (Windows, no compiler needed)
208
288
 
209
- The wheel bundles the prebuilt CPU kernel and its OpenMP runtime, so nothing has to
210
- be built after installing:
211
-
212
289
  ```bash
213
- 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
290
+ pip install bitsandbytes-cpu-fork
214
291
  ```
215
292
 
216
- One wheel covers every Python 3 version on 64-bit Windows. `pip` pulls `torch` and
217
- `numpy` itself. The import name is unchanged, so existing code and the
218
- Transformers / PEFT / Diffusers integrations keep working as-is:
293
+ The wheel bundles the prebuilt CPU kernel and its OpenMP runtime, so nothing has to
294
+ be built after installing; `pip` pulls `torch` and `numpy` itself. One wheel covers
295
+ every Python 3 version on 64-bit Windows. The import name is unchanged, so existing
296
+ code and the Transformers / PEFT / Diffusers integrations keep working as-is:
219
297
 
220
298
  ```python
221
299
  import bitsandbytes as bnb # the fork, not upstream
222
- print(bnb.__version__) # 0.50.2.dev0
300
+ print(bnb.__version__) # 0.50.2.dev1
223
301
  ```
224
302
 
225
303
  Building from source instead (any platform) is described in
@@ -75,7 +75,7 @@ __pdoc__ = {
75
75
  "optim.optimizer.MockArgs": False,
76
76
  }
77
77
 
78
- __version__ = "0.50.2.dev0"
78
+ __version__ = "0.50.2.dev1"
79
79
 
80
80
  # 挂载 gdn_cpu(GDN 融合内核 / patch_transformers 入口),让 bnb.gdn_cpu 可直接访问
81
81
  from . import gdn_cpu # noqa: E402,F401
@@ -0,0 +1,50 @@
1
+ """Compatibility shim. The reference itself lives in `bitsandbytes_cpu_cli`.
2
+
3
+ Why it is not here: `bitsandbytes/__init__.py` imports torch, and torch is deliberately
4
+ not a dependency of this distribution. So this module can only be imported on a machine
5
+ that already has torch -- which is not the machine whose user needs the help. The console
6
+ script therefore points at the top-level `bitsandbytes_cpu_cli`, which uses nothing but
7
+ the standard library.
8
+
9
+ This file is kept so that `python -m bitsandbytes.cli help` and code that imports the
10
+ tables from here keep working once torch is installed.
11
+ """
12
+ from __future__ import annotations
13
+
14
+ import sys
15
+
16
+ from bitsandbytes_cpu_cli import ( # noqa: F401
17
+ EXAMPLES,
18
+ PY,
19
+ SECTIONS,
20
+ SH,
21
+ USAGE,
22
+ WIDTH,
23
+ _row,
24
+ _select,
25
+ _wrap,
26
+ cmd_detect,
27
+ cmd_doctor,
28
+ cmd_help,
29
+ cmd_selftest,
30
+ cmd_version,
31
+ main,
32
+ render_markdown,
33
+ render_text,
34
+ )
35
+
36
+ __all__ = [
37
+ "EXAMPLES",
38
+ "PY",
39
+ "SECTIONS",
40
+ "SH",
41
+ "USAGE",
42
+ "WIDTH",
43
+ "main",
44
+ "render_markdown",
45
+ "render_text",
46
+ ]
47
+
48
+
49
+ if __name__ == "__main__":
50
+ sys.exit(main())
@@ -0,0 +1,189 @@
1
+ # -*- coding: utf-8 -*-
2
+ """detect_cpu.py — 一键检测 CPU 能力 + 推荐配置(开源小白友好)。
3
+
4
+ 自动检测并推荐:
5
+ - CPU 型号 / 物理核 / 逻辑核 / AVX2 / AVX-512
6
+ - 内存总量/可用
7
+ - 推荐线程数(按 GEMM/conv 任务类型)
8
+ - 是否建议用 bnb 8-bit 优化器 / 量化基座 / disk_balancer
9
+ 输出一行可用作配置的推荐摘要,可被训练脚本直接使用。
10
+
11
+ 用法:
12
+ python detect_cpu.py # 打印全部检测 + 推荐
13
+ python detect_cpu.py --json # 输出 JSON(供脚本解析)
14
+ """
15
+ import argparse
16
+ import json
17
+ import os
18
+ import platform
19
+
20
+
21
+ def _cpu_model() -> str:
22
+ """The CPU's name, not the first line of whatever tool we asked.
23
+
24
+ `lscpu` was run and its FIRST line taken, which on every Linux is
25
+ "Architecture: x86_64" -- the report said the CPU was a machine architecture. The
26
+ model name is on the "Model name:" line; /proc/cpuinfo carries it too, and does not
27
+ depend on util-linux being installed.
28
+
29
+ Windows keeps the wmic path but parses the value out rather than the first line,
30
+ since `wmic ... /value` emits "Key=Value" lines whose order is not guaranteed.
31
+ """
32
+ try:
33
+ import subprocess
34
+ if os.name == "nt":
35
+ # Registry first. `wmic` has been removed from current Windows builds, and
36
+ # when it is missing the old code fell through to platform.processor(),
37
+ # which reports "AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD" -- a
38
+ # description of the CPU's family, not its name. The registry key is where
39
+ # the name actually lives and needs no subprocess.
40
+ try:
41
+ import winreg
42
+ k = winreg.OpenKey(
43
+ winreg.HKEY_LOCAL_MACHINE,
44
+ r"HARDWARE\DESCRIPTION\System\CentralProcessor\0")
45
+ return winreg.QueryValueEx(k, "ProcessorNameString")[0].strip()
46
+ except Exception:
47
+ pass
48
+ out = subprocess.run(
49
+ ["wmic", "cpu", "get", "Name", "/value"],
50
+ capture_output=True, text=True, timeout=15).stdout
51
+ for line in out.splitlines():
52
+ if line.strip().lower().startswith("name="):
53
+ return line.split("=", 1)[1].strip()
54
+ else:
55
+ # /proc/cpuinfo first: no dependency on lscpu being present.
56
+ try:
57
+ with open("/proc/cpuinfo", encoding="utf-8", errors="replace") as fh:
58
+ for line in fh:
59
+ if line.lower().startswith("model name"):
60
+ return line.split(":", 1)[1].strip()
61
+ except OSError:
62
+ pass
63
+ out = subprocess.run(["lscpu"], capture_output=True, text=True,
64
+ timeout=15).stdout
65
+ for line in out.splitlines():
66
+ if line.lower().startswith("model name"):
67
+ return line.split(":", 1)[1].strip()
68
+ except Exception:
69
+ pass
70
+ return platform.processor() or "unknown-cpu"
71
+
72
+
73
+ def _physical_cores() -> int:
74
+ """Physical cores, not logical ones: an SMT machine reports twice as many threads
75
+ and the recommendation below depends on the difference.
76
+
77
+ Tries the package-relative import first, because this module now ships inside
78
+ `bitsandbytes`. The bare import is kept for the checkout layout, where the two files
79
+ sit next to each other at the repository root and there is no package to be relative
80
+ to. Falling back to os.cpu_count() reports LOGICAL cores, which on an SMT machine
81
+ makes the recommendation wrong -- so that is the last resort, not the first.
82
+ """
83
+ try:
84
+ from . import torch_cpu_kit as tck
85
+ return tck.physical_cores()
86
+ except Exception:
87
+ pass
88
+ try:
89
+ import torch_cpu_kit as tck
90
+ return tck.physical_cores()
91
+ except Exception:
92
+ return os.cpu_count() or 1
93
+
94
+
95
+ def _mem() -> tuple[float, float]:
96
+ try:
97
+ import psutil
98
+ vm = psutil.virtual_memory()
99
+ return vm.total / 1e9, vm.available / 1e9
100
+ except Exception:
101
+ return 0.0, 0.0
102
+
103
+
104
+ def _cpu_capability() -> str:
105
+ try:
106
+ import torch
107
+ return torch.backends.cpu.get_cpu_capability()
108
+ except Exception:
109
+ return "unknown"
110
+
111
+
112
+ def _recommend_threads(logical: int, physical: int) -> dict:
113
+ """Recommend a thread count per task, from measurements rather than from core count.
114
+
115
+ The previous version returned `logical` for diffusion on any SMT machine, on the
116
+ stated basis that "conv benefits from hyperthreading". Measured on the i5-10400
117
+ (6 physical / 12 logical), that is wrong for the workload this project actually
118
+ runs. The Qwen-Image-2.1 step is 82% dense GEMM, and on the four shapes that model
119
+ uses, six threads beat twelve on every one:
120
+
121
+ 16384x4096x4096 6T 1.316 s 12T 1.449 s
122
+ 16384x4096x12288 6T 4.048 s 12T 4.325 s
123
+ 4096x4096x4096 6T 0.335 s 12T 0.390 s
124
+ GFLOPS 6T 407-418 12T 352-381
125
+
126
+ A whole 1024x1024 render agreed: 225 s/step at 12 threads against 203 at 6. The
127
+ second thread on a physical core shares its FP units and halves its cache, which a
128
+ compute-bound GEMM cannot absorb.
129
+
130
+ So: physical cores everywhere. The `logical` value is still returned under a
131
+ separate key for callers that know their workload is bandwidth- or latency-bound
132
+ rather than arithmetic-bound.
133
+ """
134
+ return {"lm": physical,
135
+ "diffusion": physical,
136
+ "image": physical,
137
+ "logical_if_bandwidth_bound": logical}
138
+
139
+
140
+ def detect() -> dict:
141
+ logical = os.cpu_count() or 1
142
+ physical = _physical_cores()
143
+ total_gb, avail_gb = _mem()
144
+ cap = _cpu_capability()
145
+ r = _recommend_threads(logical, physical)
146
+ return {
147
+ "cpu_model": _cpu_model(),
148
+ "physical_cores": physical,
149
+ "logical_cores": logical,
150
+ "cpu_capability": cap, # 如 AVX2 / AVX512
151
+ "has_avx2": "AVX2" in cap or "AVX512" in cap or "AVXNEON" in cap,
152
+ "has_avx512": "AVX512" in cap,
153
+ "ram_total_gb": round(total_gb, 1),
154
+ "ram_available_gb": round(avail_gb, 1),
155
+ "recommend_threads": r,
156
+ "recommend_bf16": "BF16" in cap, # AVX512-BF16/AMX 才建议 bf16
157
+ "recommend_8bit_optimizer": True, # 纯 CPU 存储紧张时 8bit 优化器省内存
158
+ # 内存读不到时(没装 psutil)不要给 True:avail_gb 是 0,< 8 会成立,
159
+ # 于是这个推荐就变成了一个由缺失依赖制造的假警报。
160
+ "recommend_disk_balancer": bool(avail_gb) and avail_gb < 8,
161
+ }
162
+
163
+
164
+ def main():
165
+ ap = argparse.ArgumentParser()
166
+ ap.add_argument("--json", action="store_true")
167
+ a = ap.parse_args()
168
+ d = detect()
169
+ if a.json:
170
+ print(json.dumps(d, ensure_ascii=False, indent=2))
171
+ return
172
+ print("=== CPU 能力检测 ===")
173
+ print(f" CPU: {d['cpu_model']}")
174
+ print(f" 物理核/逻辑核: {d['physical_cores']}/{d['logical_cores']}")
175
+ print(f" SIMD 能力: {d['cpu_capability']} (AVX2={d['has_avx2']}, AVX-512={d['has_avx512']})")
176
+ print(f" 内存: 总 {d['ram_total_gb']}GB / 可用 {d['ram_available_gb']}GB")
177
+ print("\n=== 推荐配置(实测依据)===")
178
+ t = d["recommend_threads"]
179
+ print(f" LLM 训练线程数 : {t['lm']}(GEMM 密集,超线程只会抢同一个核的 FP 单元)")
180
+ print(f" 生图线程数 : {t['diffusion']}(Qwen-Image 一步 82% 是 GEMM;i5 实测 "
181
+ f"6 线程 203 s/step vs 12 线程 225)")
182
+ print(f" 带宽受限时可用 : {t['logical_if_bandwidth_bound']}(仅当负载不是算术受限)")
183
+ print(f" 推荐 bf16 : {d['recommend_bf16']}(AVX2-only 机器应用 fp32)")
184
+ print(f" 推荐 8bit 优化器: {d['recommend_8bit_optimizer']}(内存紧张时省内存)")
185
+ print(f" 推荐 disk_balancer: {d['recommend_disk_balancer']}(内存<8GB 建议开 --flash)")
186
+
187
+
188
+ if __name__ == "__main__":
189
+ main()