compressed-tensors 0.12.3a20251114__tar.gz → 0.12.3a20251203__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 (158) hide show
  1. {compressed_tensors-0.12.3a20251114/src/compressed_tensors.egg-info → compressed_tensors-0.12.3a20251203}/PKG-INFO +1 -1
  2. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/utils/match.py +164 -35
  3. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/version.py +1 -1
  4. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203/src/compressed_tensors.egg-info}/PKG-INFO +1 -1
  5. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_utils/test_match.py +153 -12
  6. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/.github/.gitkeep +0 -0
  7. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/.github/actions/test/action.yml +0 -0
  8. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/.github/scripts/step-status +0 -0
  9. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/.github/workflows/quality-check.yaml +0 -0
  10. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/.github/workflows/test-check.yaml +0 -0
  11. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/.gitignore +0 -0
  12. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/LICENSE +0 -0
  13. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/Makefile +0 -0
  14. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/README.md +0 -0
  15. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/examples/bit_packing/ex_quantize_and_pack.py +0 -0
  16. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/examples/bit_packing/int4_config.json +0 -0
  17. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/examples/bitmask_compression.ipynb +0 -0
  18. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/examples/llama_1.1b/ex_config_quantization.py +0 -0
  19. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/examples/llama_1.1b/ex_llmcompressor_quantization.py +0 -0
  20. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/examples/llama_1.1b/example_quant_config.json +0 -0
  21. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/examples/llama_1.1b/example_quant_recipe.yaml +0 -0
  22. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/examples/quantize_and_pack_int4.ipynb +0 -0
  23. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/pyproject.toml +0 -0
  24. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/setup.cfg +0 -0
  25. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/setup.py +0 -0
  26. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/__init__.py +0 -0
  27. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/README.md +0 -0
  28. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/__init__.py +0 -0
  29. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/base.py +0 -0
  30. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/__init__.py +0 -0
  31. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/base.py +0 -0
  32. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/helpers.py +0 -0
  33. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/model_compressors/__init__.py +0 -0
  34. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/model_compressors/model_compressor.py +0 -0
  35. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/quantized_compressors/__init__.py +0 -0
  36. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/quantized_compressors/base.py +0 -0
  37. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/quantized_compressors/fp4_quantized.py +0 -0
  38. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/quantized_compressors/naive_quantized.py +0 -0
  39. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/quantized_compressors/pack_quantized.py +0 -0
  40. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/sparse_compressors/__init__.py +0 -0
  41. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/sparse_compressors/base.py +0 -0
  42. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/sparse_compressors/dense.py +0 -0
  43. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/sparse_compressors/sparse_24_bitmask.py +0 -0
  44. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/sparse_compressors/sparse_bitmask.py +0 -0
  45. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/sparse_quantized_compressors/__init__.py +0 -0
  46. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/compressors/sparse_quantized_compressors/marlin_24.py +0 -0
  47. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/config/__init__.py +0 -0
  48. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/config/base.py +0 -0
  49. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/config/dense.py +0 -0
  50. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/config/format.py +0 -0
  51. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/config/sparse_24_bitmask.py +0 -0
  52. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/config/sparse_bitmask.py +0 -0
  53. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/linear/__init__.py +0 -0
  54. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/linear/compressed_linear.py +0 -0
  55. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/logger.py +0 -0
  56. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/modeling/__init__.py +0 -0
  57. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/modeling/attention.py +0 -0
  58. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/modeling/kvcache.py +0 -0
  59. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/__init__.py +0 -0
  60. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/lifecycle/__init__.py +0 -0
  61. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/lifecycle/apply.py +0 -0
  62. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/lifecycle/compressed.py +0 -0
  63. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/lifecycle/forward.py +0 -0
  64. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/lifecycle/helpers.py +0 -0
  65. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/lifecycle/initialize.py +0 -0
  66. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/quant_args.py +0 -0
  67. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/quant_config.py +0 -0
  68. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/quant_metadata.py +0 -0
  69. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/quant_scheme.py +0 -0
  70. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/utils/__init__.py +0 -0
  71. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/utils/helpers.py +0 -0
  72. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/quantization/utils/mxfp4_utils.py +0 -0
  73. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/registry/__init__.py +0 -0
  74. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/registry/registry.py +0 -0
  75. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/__init__.py +0 -0
  76. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/apply.py +0 -0
  77. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/factory/__init__.py +0 -0
  78. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/factory/base.py +0 -0
  79. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/factory/hadamard.py +0 -0
  80. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/factory/matrix_multiply.py +0 -0
  81. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/factory/random_hadamard.py +0 -0
  82. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/transform_args.py +0 -0
  83. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/transform_config.py +0 -0
  84. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/transform_scheme.py +0 -0
  85. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/utils/__init__.py +0 -0
  86. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/utils/hadamard.py +0 -0
  87. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/utils/hadamards.safetensors +0 -0
  88. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/transform/utils/matrix.py +0 -0
  89. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/utils/__init__.py +0 -0
  90. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/utils/helpers.py +0 -0
  91. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/utils/internal.py +0 -0
  92. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/utils/offload.py +0 -0
  93. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/utils/permutations_24.py +0 -0
  94. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/utils/safetensors_load.py +0 -0
  95. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/utils/semi_structured_conversions.py +0 -0
  96. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors/utils/type.py +0 -0
  97. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors.egg-info/SOURCES.txt +0 -0
  98. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors.egg-info/dependency_links.txt +0 -0
  99. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors.egg-info/requires.txt +0 -0
  100. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/src/compressed_tensors.egg-info/top_level.txt +0 -0
  101. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/__init__.py +0 -0
  102. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/conftest.py +0 -0
  103. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/mock_observer.py +0 -0
  104. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/__init__.py +0 -0
  105. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/model_compressors/__init__.py +0 -0
  106. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/model_compressors/test_model_compressor.py +0 -0
  107. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/quantized_compressors/__init__.py +0 -0
  108. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/quantized_compressors/test_fp4_quant.py +0 -0
  109. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/quantized_compressors/test_fp8_quant.py +0 -0
  110. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/quantized_compressors/test_int_quant.py +0 -0
  111. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/quantized_compressors/test_pack_quant.py +0 -0
  112. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/quantized_compressors/test_packed_asym_decompression.py +0 -0
  113. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/sparse_compressors/__init__.py +0 -0
  114. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/sparse_compressors/test_bitmask.py +0 -0
  115. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/sparse_compressors/test_sparse_24_bitmask.py +0 -0
  116. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/sparse_quantized_compressors/__init__.py +0 -0
  117. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_compressors/sparse_quantized_compressors/test_marlin_24.py +0 -0
  118. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_configs/__init__.py +0 -0
  119. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_configs/test_base.py +0 -0
  120. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_configs/test_infer_quant.py +0 -0
  121. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_examples/test_bitmask_compression_ipynb.py +0 -0
  122. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_linear/__init__.py +0 -0
  123. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_linear/test_compressed_linear.py +0 -0
  124. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_modeling/test_attention_and_cache.py +0 -0
  125. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/__init__.py +0 -0
  126. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/lifecycle/__init__.py +0 -0
  127. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/lifecycle/conftest.py +0 -0
  128. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/lifecycle/test_apply.py +0 -0
  129. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/lifecycle/test_dynamic_lifecycle.py +0 -0
  130. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/lifecycle/test_enabled.py +0 -0
  131. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/lifecycle/test_forward.py +0 -0
  132. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/lifecycle/test_initialize.py +0 -0
  133. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/lifecycle/test_lifecycle.py +0 -0
  134. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/lifecycle/test_static_lifecycle.py +0 -0
  135. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/test_configs/__init__.py +0 -0
  136. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/test_configs/test_bit_depths.py +0 -0
  137. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/test_configs/test_strategies.py +0 -0
  138. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/test_quant_args.py +0 -0
  139. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/test_quant_config.py +0 -0
  140. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/test_quant_scheme.py +0 -0
  141. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/test_utils/test_helpers.py +0 -0
  142. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_quantization/test_utils/test_mxfp4_utils.py +0 -0
  143. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_registry.py +0 -0
  144. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_transform/conftest.py +0 -0
  145. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_transform/factory/test_correctness.py +0 -0
  146. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_transform/factory/test_memory.py +0 -0
  147. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_transform/factory/test_serialization.py +0 -0
  148. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_transform/test_transform_args.py +0 -0
  149. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_transform/test_transform_config.py +0 -0
  150. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_transform/test_transform_scheme.py +0 -0
  151. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_transform/utils/test_hadamard.py +0 -0
  152. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_utils/__init__.py +0 -0
  153. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_utils/test_helpers.py +0 -0
  154. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_utils/test_offload.py +0 -0
  155. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_utils/test_safetensors_load.py +0 -0
  156. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/test_utils/test_type.py +0 -0
  157. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/tests/testing_utils.py +0 -0
  158. {compressed_tensors-0.12.3a20251114 → compressed_tensors-0.12.3a20251203}/utils/copyright.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compressed-tensors
3
- Version: 0.12.3a20251114
3
+ Version: 0.12.3a20251203
4
4
  Summary: Library for utilization of compressed safetensors of neural network models
5
5
  Home-page: https://github.com/vllm-project/compressed-tensors
6
6
  Author: Neuralmagic, Inc.
@@ -13,7 +13,9 @@
13
13
  # limitations under the License.
14
14
 
15
15
  import logging
16
+ import os
16
17
  import re
18
+ from collections import defaultdict
17
19
  from collections.abc import Generator
18
20
  from typing import Iterable, List, Mapping, Optional, Tuple, Union
19
21
 
@@ -29,6 +31,7 @@ __all__ = [
29
31
  "match_named_parameters",
30
32
  "match_targets",
31
33
  "match_modules_set",
34
+ "get_lowest_common_ancestor_name",
32
35
  "is_match",
33
36
  "is_narrow_match",
34
37
  ]
@@ -157,34 +160,68 @@ def match_targets(
157
160
  return matched_targets
158
161
 
159
162
 
163
+ def get_lowest_common_ancestor_name(names: list[str | None]) -> str:
164
+ """
165
+ Given a list of names, returns the lowest-scope common name ignoring Nones.
166
+
167
+ Implementation is a small alteration of os.path.commonprefix
168
+ https://docs.python.org/3/library/os.path.html#os.path.commonprefix
169
+
170
+ ([s1, s2]->prefix->result)
171
+ # case 0: multiple modules: [abc.a., abc.b.] -> .abc. -> abc
172
+ # case 1: single module: [abc.] -> .abc. -> abc
173
+ # case 2: substring modules: [abc., ab.] -> .ab -> ""
174
+ # case 3: parent & child: [ab., ab.a.] -> .ab. -> ab
175
+ """
176
+ names = [name for name in names if name is not None]
177
+ if len(names) == 0:
178
+ return ""
179
+
180
+ # 1) find longest shared prefix
181
+ s1 = "." + min(names) + "."
182
+ s2 = "." + max(names) + "."
183
+ common_prefix = os.path.commonprefix([s1, s2])
184
+ # 2) throw away right most dot and name fragment, throw away leftmost char
185
+ # ".keep.thro" -> "keep", "." -> ""
186
+ return common_prefix[1 : common_prefix.rfind(".")]
187
+
188
+
160
189
  def match_modules_set(
161
190
  model: torch.nn.Module,
162
191
  targets: Optional[Iterable[str]],
163
192
  ignore: Optional[Iterable[str]] = None,
164
- ) -> Generator[Iterable[torch.nn.Module]]:
193
+ error_on_module_rematch: bool = True,
194
+ ) -> Generator[List[List[torch.nn.Module]]]:
165
195
  """
166
- Yields modules grouped with the same order and size as `targets`.
167
- Values are returned in order of `model.named_modules()`
196
+ Yields modules grouped by parent context.
197
+
198
+ We group by parent context so that we can return ALL matches of a
199
+ specific target that can be paired with another target. This is most
200
+ relevant in the case of MoE modules with multiple modules for each
201
+ expert i.e. post_attention_layernorm <-> mlp.expert.N.gate_proj,
202
+ mlp.expert.N.up_proj for all N. The parent context will differ from
203
+ one layer to another while being the same for one expert to another.
168
204
 
169
- E.g. the following targets would yield module belonging to the following layers:
205
+ Each returned group is a list (of lists) with the same size
206
+ and order as `targets` while all matches for each target and
207
+ the overall order of the groups are ordered in the same way
208
+ as `model.named_modules`
209
+
210
+
211
+ E.g. the following targets would yield modules belonging to the following layers:
170
212
  ```python3
171
213
  match_modules_set(model, ["q_proj", "k_proj", "v_proj"]) == (
172
- (
173
- `model.layers.0.self_attn.q_proj`,
174
- `model.layers.0.self_attn.k_proj`,
175
- `model.layers.0.self_attn.v_proj`,
176
- ),
177
- (
178
- `model.layers.1.self_attn.q_proj`,
179
- `model.layers.1.self_attn.k_proj`,
180
- `model.layers.1.self_attn.v_proj`,
181
- ),
214
+ [
215
+ [`layers.0.self_attn.q_proj`],
216
+ [`layers.0.self_attn.k_proj`],
217
+ [`layers.0.self_attn.v_proj`],
218
+ ],
219
+ [
220
+ [`layers.1.self_attn.q_proj`],
221
+ [`layers.1.self_attn.k_proj`],
222
+ [`layers.1.self_attn.v_proj`],
223
+ ],
182
224
  ...
183
- (
184
- `model.layers.32.self_attn.q_proj`,
185
- `model.layers.32.self_attn.k_proj`,
186
- `model.layers.32.self_attn.v_proj`,
187
- ),
188
225
  )
189
226
  ```
190
227
 
@@ -192,33 +229,125 @@ def match_modules_set(
192
229
  For example, matching layer norms to their subsequent linear layers
193
230
  ```python3
194
231
  for norm, q, k, v in match_modules_set(model, (norm_tgt, q_tgt, k_tgt, v_tgt)):
195
- fuse_norm_linears(norm, [q, k, v])
232
+ fuse_norm_linears(*norm, [*q, *k, *v])
233
+ ```
234
+
235
+ Alternatively for MoE you would get multiple matches
236
+ per target per group, E.g.
237
+
238
+ ```python3
239
+
240
+ targets = [
241
+ "post_attention_layernorm",
242
+ "up_proj",
243
+ "down_proj"
244
+ ]
245
+ match_modules_set(model, targets) == (
246
+ [
247
+ [layers.0.post_attention_layernorm],
248
+ [
249
+ `layers.0.mlp.experts.0.up_proj`,
250
+ `layers.0.mlp.experts.1.up_proj`,
251
+ ...
252
+ ],
253
+ [
254
+ `layers.0.mlp.experts.0.down_proj`,
255
+ `layers.0.mlp.experts.1.down_proj`,
256
+ ...
257
+
258
+ ]
259
+ ], # <- first yield
260
+ [
261
+ [layers.1.post_attention_layernorm],
262
+ [
263
+ `layers.1.mlp.experts.0.up_proj`,
264
+ `layers.1.mlp.experts.1.up_proj`,
265
+ ...
266
+ ],
267
+ [
268
+ `layers.1.mlp.experts.0.down_proj`,
269
+ `layers.1.mlp.experts.1.down_proj`,
270
+ ...
271
+ ]
272
+ ],
273
+ ...
274
+ )
275
+ ```
196
276
 
197
277
  :param model: model containing modules to match against
198
278
  :param targets: target strings, potentially containing "re:" prefixes
199
279
  :param ignore: targets to ignore, potentially containing "re:" prefixes
280
+ :param error_on_module_rematch: if True, errors when a module gets
281
+ matched to multiple targets, if False, no error. (Defaults to True)
200
282
  """
201
283
  targets = targets or []
202
284
  ignore = ignore or []
203
285
 
204
- matches = dict.fromkeys(targets, None)
286
+ # as we iterate through modules and try to match them with targets,
287
+ # the algorithm can be in 2 possible states:
288
+ # 0) unmatched_targets > 0, i.e. some of the targets haven't been matched.
289
+ # Keep matching until all targets have at least one match
290
+ # 1) unmatched_targets == 0 i.e. we have at least one match for each target.
291
+ # At this point we are unsure if we have a full set or if we need to add
292
+ # more matches.
293
+ # There are 3 things that can happen once were in state 1:
294
+ # A) found a new match with same parent_context,
295
+ # (add it to matches and keep going)
296
+ # B) found a new match with different parent_context, i.e. we found a match
297
+ # that requires a deeper parent context, this indicates that this match
298
+ # should be part of a new set.
299
+ # (yield current set [not including newest match] and go back to state 0)
300
+ # C) ran out of modules, we will always yield the final remaining set when
301
+ # we we've iterated through all the modules in the model.
302
+ # (yield final set then exit.)
303
+ # Note: its possible to iterate through all the modules in the model while
304
+ # not having a full matched set if the user specified a bad matching, in
305
+ # that case something has gone wrong and we error
306
+ matches = defaultdict(list)
307
+ parent_context = None
308
+ unmatched_targets = set(targets)
309
+
205
310
  for name, module in model.named_modules():
206
- # match until we get a full set
311
+ matched_targets_for_cur_module = set()
207
312
  for target in targets:
208
313
  if is_match(name, module, target, ignore):
209
- if matches[target] is not None:
210
- raise ValueError(f"Matched a {target} twice before completing set")
211
- matches[target] = module
212
-
213
- # once we have a full set, yield and reset
214
- if targets and all((matches[target] is not None for target in targets)):
215
- yield [matches[target] for target in targets] # ensure correct ordering
216
- matches = dict.fromkeys(targets, None)
217
-
218
- # check that none are left over
219
- unmatched_keys = [match for match, value in matches.items() if value is not None]
220
- if len(unmatched_keys):
221
- raise ValueError(f"Unable to match targets into set: {unmatched_keys}")
314
+ new_parent_context = get_lowest_common_ancestor_name(
315
+ [name, parent_context]
316
+ )
317
+
318
+ # code for (B)
319
+ if not unmatched_targets and new_parent_context != parent_context:
320
+ yield [matches[target] for target in targets]
321
+ matches = defaultdict(list)
322
+ new_parent_context = name
323
+ unmatched_targets = set(targets)
324
+
325
+ matches[target].append(module)
326
+ parent_context = new_parent_context
327
+ unmatched_targets -= {target}
328
+ matched_targets_for_cur_module |= {target}
329
+
330
+ if len(matched_targets_for_cur_module) > 1 and error_on_module_rematch:
331
+ raise ValueError(
332
+ f"module: {name} was matched with multiple targets: "
333
+ f"{matched_targets_for_cur_module} which is unexpected "
334
+ "disable this check by setting `error_on_module_rematch = False`"
335
+ )
336
+
337
+ # never found anything
338
+ if unmatched_targets == set(targets):
339
+ return
340
+
341
+ # code for (C)
342
+ if not unmatched_targets: # have a full matching
343
+ yield [matches[target] for target in targets]
344
+ return
345
+
346
+ raise ValueError(
347
+ f"Found a final incomplete set with matches found for keys: "
348
+ f"{set(targets) - unmatched_targets} "
349
+ f"but no matches found for keys: {unmatched_targets}"
350
+ )
222
351
 
223
352
 
224
353
  def is_match(
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.12.3.a20251114'
20
+ __version__ = version = '0.12.3.a20251203'
21
21
  __version_tuple__ = version_tuple = (0, 12, 3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compressed-tensors
3
- Version: 0.12.3a20251114
3
+ Version: 0.12.3a20251203
4
4
  Summary: Library for utilization of compressed safetensors of neural network models
5
5
  Home-page: https://github.com/vllm-project/compressed-tensors
6
6
  Author: Neuralmagic, Inc.
@@ -20,6 +20,7 @@ import torch.nn as nn
20
20
  # Assuming the module is named "module_matching" - adjust import as needed
21
21
  from compressed_tensors.utils import (
22
22
  InternalModule,
23
+ get_lowest_common_ancestor_name,
23
24
  is_match,
24
25
  is_narrow_match,
25
26
  match_modules_set,
@@ -79,6 +80,39 @@ class DummyModel(nn.Module):
79
80
  )
80
81
 
81
82
 
83
+ class DummyMoEModel(nn.Module):
84
+ """Test MoE model for unit tests. Weights are initialized on meta device"""
85
+
86
+ def __init__(self, num_layers=2, num_experts=4):
87
+ super().__init__()
88
+ self.layers = nn.ModuleList(
89
+ [
90
+ nn.ModuleDict(
91
+ {
92
+ "post_attention_layernorm": nn.LayerNorm(3),
93
+ "mlp": nn.ModuleDict(
94
+ {
95
+ "experts": nn.ModuleList(
96
+ [
97
+ nn.ModuleDict(
98
+ {
99
+ "gate_proj": nn.Linear(3, 6),
100
+ "up_proj": nn.Linear(3, 6),
101
+ "down_proj": nn.Linear(6, 3),
102
+ }
103
+ )
104
+ for _ in range(num_experts)
105
+ ]
106
+ ),
107
+ }
108
+ ),
109
+ }
110
+ )
111
+ for _ in range(num_layers)
112
+ ]
113
+ )
114
+
115
+
82
116
  class TestMatchName:
83
117
  """Test cases for _match_name function"""
84
118
 
@@ -412,6 +446,58 @@ class TestMatchNamedParameters:
412
446
  assert len(matches) == 0
413
447
 
414
448
 
449
+ class TestGetLowestCommonModuleName:
450
+ """Test cases for get_lowest_common_ancestor_name function"""
451
+
452
+ def test_multiple_modules(self):
453
+ assert "abc" == get_lowest_common_ancestor_name(
454
+ [
455
+ "abc.a",
456
+ "abc.b",
457
+ "abc.c",
458
+ ]
459
+ )
460
+
461
+ def test_single_module(self):
462
+ assert "abc.abc" == get_lowest_common_ancestor_name(
463
+ [
464
+ "abc.abc",
465
+ ]
466
+ )
467
+
468
+ def test_substring_modules(self):
469
+ assert "abc" == get_lowest_common_ancestor_name(
470
+ [
471
+ "abc.abc",
472
+ "abc.ab",
473
+ ]
474
+ )
475
+
476
+ def test_parent_and_child_modules(self):
477
+ assert "abc.abc" == get_lowest_common_ancestor_name(
478
+ [
479
+ "abc.abc.ab",
480
+ "abc.abc",
481
+ ]
482
+ )
483
+
484
+ def test_root(self):
485
+ assert "" == get_lowest_common_ancestor_name(
486
+ [
487
+ "abc.abc",
488
+ "b.abc",
489
+ ]
490
+ )
491
+
492
+ def test_ignore_none(self):
493
+ assert "abc.abc" == get_lowest_common_ancestor_name(
494
+ [
495
+ "abc.abc",
496
+ None,
497
+ ]
498
+ )
499
+
500
+
415
501
  class TestMatchModulesSet:
416
502
  """Test cases for match_modules_set function"""
417
503
 
@@ -432,7 +518,71 @@ class TestMatchModulesSet:
432
518
  # Each set should have 3 modules
433
519
  for module_set in matches:
434
520
  assert len(module_set) == 3
435
- assert all(isinstance(m, nn.Linear) for m in module_set)
521
+ assert all(isinstance(*m, nn.Linear) for m in module_set)
522
+
523
+ def test_moe_module_match(self):
524
+ """Test matching MoE modules with multiple experts per layer"""
525
+ model = DummyMoEModel(num_layers=2, num_experts=4)
526
+
527
+ # Test matching expert projections - each expert becomes its own set
528
+ # because the parent context differs between experts
529
+ targets = [
530
+ "re:.*gate_proj$",
531
+ "re:.*up_proj$",
532
+ ]
533
+
534
+ matches = list(match_modules_set(model, targets))
535
+
536
+ # Should have 8 sets (2 layers * 4 experts)
537
+ assert len(matches) == 8
538
+
539
+ # Each set should have 2 target lists (gate_proj, up_proj)
540
+ for expert_group in matches:
541
+ assert len(expert_group) == 2
542
+ gate_modules, up_modules = expert_group
543
+
544
+ # Each target should have matched 1 module (single expert)
545
+ assert len(gate_modules) == 1
546
+ assert len(up_modules) == 1
547
+
548
+ # All modules should be Linear layers
549
+ assert isinstance(gate_modules[0], nn.Linear)
550
+ assert isinstance(up_modules[0], nn.Linear)
551
+
552
+ def test_moe_with_layernorm_match(self):
553
+ """
554
+ Test matching MoE modules with their corresponding layer norms.
555
+ Including a layer-level module (layernorm) groups all experts in
556
+ that layer together.
557
+ """
558
+ model = DummyMoEModel(num_layers=2, num_experts=3)
559
+
560
+ # Match layer norm with expert projections - the layernorm is at layer level,
561
+ # so it establishes a common parent context for all experts in that layer
562
+ targets = [
563
+ "re:.*post_attention_layernorm$",
564
+ "re:.*gate_proj$",
565
+ "re:.*up_proj$",
566
+ ]
567
+
568
+ matches = list(match_modules_set(model, targets))
569
+
570
+ # Should have 2 layer groups (one per layer)
571
+ assert len(matches) == 2
572
+
573
+ for layer_group in matches:
574
+ assert len(layer_group) == 3
575
+ norm_modules, gate_modules, up_modules = layer_group
576
+
577
+ # LayerNorm should have 1 module (single per layer)
578
+ assert len(norm_modules) == 1
579
+ assert isinstance(norm_modules[0], nn.LayerNorm)
580
+
581
+ # Each projection should have 3 experts (all experts in the layer)
582
+ assert len(gate_modules) == 3
583
+ assert len(up_modules) == 3
584
+ assert all(isinstance(m, nn.Linear) for m in gate_modules)
585
+ assert all(isinstance(m, nn.Linear) for m in up_modules)
436
586
 
437
587
  def test_module_set_ordering(self):
438
588
  """Test that module sets maintain target ordering"""
@@ -448,6 +598,7 @@ class TestMatchModulesSet:
448
598
  for module_set in matches:
449
599
  # Check that modules are returned in target order (v, q, k)
450
600
  v_proj, q_proj, k_proj = module_set
601
+ v_proj, q_proj, k_proj = *v_proj, *q_proj, *k_proj
451
602
  # We can't easily check the exact modules, but can check they're all Linear
452
603
  assert all(isinstance(m, nn.Linear) for m in [v_proj, q_proj, k_proj])
453
604
 
@@ -456,18 +607,8 @@ class TestMatchModulesSet:
456
607
  model = DummyModel()
457
608
  targets = ["layer1", "nonexistent_module"]
458
609
 
459
- with pytest.raises(ValueError, match="Unable to match targets into set"):
460
- list(match_modules_set(model, targets))
461
-
462
- def test_duplicate_match_error(self):
463
- """Test error when same target matches multiple times before set completion"""
464
- model = DummyModel()
465
- # This should cause the same target to match multiple times
466
- # before we can complete a set
467
- targets = ["Linear", "Linear"] # Two identical targets
468
-
469
610
  with pytest.raises(
470
- ValueError, match="Matched a .* twice before completing set"
611
+ ValueError, match="Found a final incomplete set with matches found for keys"
471
612
  ):
472
613
  list(match_modules_set(model, targets))
473
614