compressed-tensors 0.10.3a20250703__tar.gz → 0.10.3a20250708__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 (145) hide show
  1. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/.github/actions/test/action.yml +32 -0
  2. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/.github/workflows/test.yml +17 -0
  3. {compressed_tensors-0.10.3a20250703/src/compressed_tensors.egg-info → compressed_tensors-0.10.3a20250708}/PKG-INFO +2 -1
  4. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/setup.py +1 -1
  5. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/factory/hadamard.py +33 -12
  6. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/factory/matrix_multiply.py +1 -0
  7. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/factory/random_hadamard.py +10 -3
  8. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/transform_config.py +2 -2
  9. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/transform_scheme.py +3 -4
  10. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/utils/helpers.py +17 -4
  11. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/version.py +1 -1
  12. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708/src/compressed_tensors.egg-info}/PKG-INFO +2 -1
  13. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors.egg-info/requires.txt +1 -0
  14. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_transform/test_transform_scheme.py +4 -4
  15. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/.github/.gitkeep +0 -0
  16. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/.github/scripts/step-status +0 -0
  17. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/.github/workflows/build-test.yml +0 -0
  18. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/.github/workflows/build.yml +0 -0
  19. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/.github/workflows/report.yml +0 -0
  20. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/.github/workflows/test-check.yaml +0 -0
  21. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/.github/workflows/trigger-all.yml +0 -0
  22. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/.github/workflows/upload.yml +0 -0
  23. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/.gitignore +0 -0
  24. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/LICENSE +0 -0
  25. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/Makefile +0 -0
  26. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/README.md +0 -0
  27. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/examples/bit_packing/ex_quantize_and_pack.py +0 -0
  28. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/examples/bit_packing/int4_config.json +0 -0
  29. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/examples/bitmask_compression.ipynb +0 -0
  30. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/examples/llama_1.1b/ex_config_quantization.py +0 -0
  31. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/examples/llama_1.1b/ex_llmcompressor_quantization.py +0 -0
  32. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/examples/llama_1.1b/example_quant_config.json +0 -0
  33. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/examples/llama_1.1b/example_quant_recipe.yaml +0 -0
  34. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/examples/quantize_and_pack_int4.ipynb +0 -0
  35. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/pyproject.toml +0 -0
  36. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/setup.cfg +0 -0
  37. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/__init__.py +0 -0
  38. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/README.md +0 -0
  39. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/__init__.py +0 -0
  40. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/base.py +0 -0
  41. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/__init__.py +0 -0
  42. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/base.py +0 -0
  43. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/helpers.py +0 -0
  44. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/model_compressors/__init__.py +0 -0
  45. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/model_compressors/model_compressor.py +0 -0
  46. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/quantized_compressors/__init__.py +0 -0
  47. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/quantized_compressors/base.py +0 -0
  48. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/quantized_compressors/naive_quantized.py +0 -0
  49. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/quantized_compressors/nvfp4_quantized.py +0 -0
  50. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/quantized_compressors/pack_quantized.py +0 -0
  51. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/sparse_compressors/__init__.py +0 -0
  52. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/sparse_compressors/base.py +0 -0
  53. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/sparse_compressors/dense.py +0 -0
  54. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/sparse_compressors/sparse_24_bitmask.py +0 -0
  55. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/sparse_compressors/sparse_bitmask.py +0 -0
  56. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/sparse_quantized_compressors/__init__.py +0 -0
  57. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/compressors/sparse_quantized_compressors/marlin_24.py +0 -0
  58. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/config/__init__.py +0 -0
  59. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/config/base.py +0 -0
  60. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/config/dense.py +0 -0
  61. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/config/sparse_24_bitmask.py +0 -0
  62. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/config/sparse_bitmask.py +0 -0
  63. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/linear/__init__.py +0 -0
  64. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/linear/compressed_linear.py +0 -0
  65. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/__init__.py +0 -0
  66. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/lifecycle/__init__.py +0 -0
  67. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/lifecycle/apply.py +0 -0
  68. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/lifecycle/compressed.py +0 -0
  69. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/lifecycle/forward.py +0 -0
  70. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/lifecycle/helpers.py +0 -0
  71. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/lifecycle/initialize.py +0 -0
  72. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/quant_args.py +0 -0
  73. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/quant_config.py +0 -0
  74. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/quant_scheme.py +0 -0
  75. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/utils/__init__.py +0 -0
  76. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/quantization/utils/helpers.py +0 -0
  77. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/registry/__init__.py +0 -0
  78. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/registry/registry.py +0 -0
  79. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/__init__.py +0 -0
  80. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/factory/__init__.py +0 -0
  81. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/factory/base.py +0 -0
  82. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/transform_args.py +0 -0
  83. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/utils/__init__.py +0 -0
  84. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/utils/hadamard.py +0 -0
  85. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/utils/hadamards.safetensors +0 -0
  86. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/transform/utils/utils.py +0 -0
  87. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/utils/__init__.py +0 -0
  88. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/utils/offload.py +0 -0
  89. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/utils/permutations_24.py +0 -0
  90. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/utils/permute.py +0 -0
  91. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/utils/safetensors_load.py +0 -0
  92. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors/utils/semi_structured_conversions.py +0 -0
  93. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors.egg-info/SOURCES.txt +0 -0
  94. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors.egg-info/dependency_links.txt +0 -0
  95. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/src/compressed_tensors.egg-info/top_level.txt +0 -0
  96. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/__init__.py +0 -0
  97. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/conftest.py +0 -0
  98. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/__init__.py +0 -0
  99. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/model_compressors/__init__.py +0 -0
  100. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/model_compressors/test_model_compressor.py +0 -0
  101. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/quantized_compressors/__init__.py +0 -0
  102. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/quantized_compressors/test_fp8_quant.py +0 -0
  103. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/quantized_compressors/test_int_quant.py +0 -0
  104. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/quantized_compressors/test_nvfp4_quant.py +0 -0
  105. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/quantized_compressors/test_pack_quant.py +0 -0
  106. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/sparse_compressors/__init__.py +0 -0
  107. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/sparse_compressors/test_bitmask.py +0 -0
  108. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/sparse_compressors/test_sparse_24_bitmask.py +0 -0
  109. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/sparse_quantized_compressors/__init__.py +0 -0
  110. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_compressors/sparse_quantized_compressors/test_marlin_24.py +0 -0
  111. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_configs/__init__.py +0 -0
  112. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_configs/test_base.py +0 -0
  113. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_examples/test_bitmask_compression_ipynb.py +0 -0
  114. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_linear/__init__.py +0 -0
  115. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_linear/test_compressed_linear.py +0 -0
  116. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/__init__.py +0 -0
  117. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/lifecycle/__init__.py +0 -0
  118. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/lifecycle/conftest.py +0 -0
  119. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/lifecycle/test_apply.py +0 -0
  120. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/lifecycle/test_dynamic_lifecycle.py +0 -0
  121. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/lifecycle/test_enabled.py +0 -0
  122. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/lifecycle/test_forward.py +0 -0
  123. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/lifecycle/test_helpers.py +0 -0
  124. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/lifecycle/test_initialize.py +0 -0
  125. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/lifecycle/test_lifecycle.py +0 -0
  126. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/test_configs/__init__.py +0 -0
  127. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/test_configs/test_bit_depths.py +0 -0
  128. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/test_configs/test_strategies.py +0 -0
  129. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/test_quant_args.py +0 -0
  130. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/test_quant_config.py +0 -0
  131. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/test_quant_scheme.py +0 -0
  132. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_quantization/test_utils/test_helpers.py +0 -0
  133. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_registry.py +0 -0
  134. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_transform/conftest.py +0 -0
  135. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_transform/factory/test_correctness.py +0 -0
  136. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_transform/factory/test_memory.py +0 -0
  137. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_transform/test_transform_args.py +0 -0
  138. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_transform/test_transform_config.py +0 -0
  139. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_transform/utils/test_hadamard.py +0 -0
  140. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_utils/__init__.py +0 -0
  141. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_utils/test_helpers.py +0 -0
  142. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_utils/test_offload.py +0 -0
  143. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/test_utils/test_safetensors_load.py +0 -0
  144. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/tests/testing_utils.py +0 -0
  145. {compressed_tensors-0.10.3a20250703 → compressed_tensors-0.10.3a20250708}/utils/copyright.py +0 -0
@@ -7,6 +7,10 @@ inputs:
7
7
  suitename:
8
8
  description: "test suite name"
9
9
  required: true
10
+ code_coverage:
11
+ description: whether to collect code coverage metrics during test run
12
+ type: boolean
13
+ default: false
10
14
  outputs:
11
15
  status:
12
16
  description: "final status from test"
@@ -44,9 +48,37 @@ runs:
44
48
  run: |
45
49
  source ${{ inputs.venv }}/bin/activate
46
50
  rm -rf src
51
+
52
+ if [[ "${ENABLE_COVERAGE}" == "true" ]]; then
53
+ echo "::group::Installing code coverage requirements via pip"
54
+ pip install bashlex https://github.com/neuralmagic/pytest-nm-releng/archive/v0.4.0.tar.gz
55
+ pip install coverage pytest-cov
56
+
57
+ # Adding Code coverage to the tests
58
+ nmre-generate-coverage-flags --package "compressed_tensors" --output-file ".coverage_flags.sh"
59
+ source .coverage_flags.sh
60
+ echo "::endgroup::"
61
+ fi
62
+
63
+ echo "::group::running tests"
64
+ echo "PYTEST_ADDOPTS set to: ${PYTEST_ADDOPTS}"
65
+
47
66
  SUCCESS=0
48
67
  pytest tests --junitxml=test-results/report.xml -o junit_suite_name="${{ inputs.suitename }}" || SUCCESS=$?
49
68
  echo "status=${SUCCESS}" >> "$GITHUB_OUTPUT"
69
+ echo "::endgroup::"
70
+
71
+ if [[ "${ENABLE_COVERAGE}" == "true" ]]; then
72
+ echo "::group::consolidating coverage reports"
73
+ mkdir -p coverage-results
74
+ mv .coverage coverage-results/ || echo ".coverage file not found"
75
+ mv coverage-html coverage-results/ || echo "coverage-html folder not found"
76
+ mv coverage.json coverage-results/ || echo "coverage.json file not found"
77
+ echo "::endgroup::"
78
+ fi
79
+
50
80
  deactivate
51
81
  exit ${SUCCESS}
52
82
  shell: bash
83
+ env:
84
+ ENABLE_COVERAGE: ${{ inputs.code_coverage || false }}
@@ -25,6 +25,10 @@ on:
25
25
  run_id:
26
26
  description: run id of the BUILD job that generated the assets
27
27
  type: string
28
+ code_coverage:
29
+ description: whether to collect code coverage metrics during test run
30
+ type: boolean
31
+ default: false
28
32
 
29
33
  # makes workflow manually callable
30
34
  workflow_dispatch:
@@ -51,6 +55,10 @@ on:
51
55
  run_id:
52
56
  description: run id of the BUILD job that generated the assets
53
57
  type: string
58
+ code_coverage:
59
+ description: whether to collect code coverage metrics during test run
60
+ type: boolean
61
+ default: false
54
62
 
55
63
  jobs:
56
64
 
@@ -124,6 +132,7 @@ jobs:
124
132
  with:
125
133
  venv: ${{ steps.create_venv.outputs.penv }}
126
134
  suitename: test-${{ inputs.python }}-${{ inputs.test_label }}
135
+ code_coverage: ${{ inputs.code_coverage }}
127
136
 
128
137
  - name: summary
129
138
  uses: neuralmagic/nm-actions/actions/summary-test@v1.13.0
@@ -146,3 +155,11 @@ jobs:
146
155
  name: report-${{ inputs.test_label }}.xml
147
156
  path: test-results/report.xml
148
157
  retention-days: 5
158
+
159
+ - name: upload coverage report
160
+ uses: actions/upload-artifact@v4
161
+ if: (success() || failure()) && inputs.code_coverage
162
+ with:
163
+ name: coverage-results
164
+ path: coverage-results/*
165
+ retention-days: 5
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compressed-tensors
3
- Version: 0.10.3a20250703
3
+ Version: 0.10.3a20250708
4
4
  Summary: Library for utilization of compressed safetensors of neural network models
5
5
  Home-page: https://github.com/neuralmagic/compressed-tensors
6
6
  Author: Neuralmagic, Inc.
@@ -11,6 +11,7 @@ License-File: LICENSE
11
11
  Requires-Dist: torch>=1.7.0
12
12
  Requires-Dist: transformers
13
13
  Requires-Dist: pydantic>=2.0
14
+ Requires-Dist: frozendict
14
15
  Provides-Extra: dev
15
16
  Requires-Dist: black==22.12.0; extra == "dev"
16
17
  Requires-Dist: isort==5.8.0; extra == "dev"
@@ -88,7 +88,7 @@ def _setup_packages() -> List:
88
88
  )
89
89
 
90
90
  def _setup_install_requires() -> List:
91
- return ["torch>=1.7.0", "transformers", "pydantic>=2.0"]
91
+ return ["torch>=1.7.0", "transformers", "pydantic>=2.0", "frozendict"]
92
92
 
93
93
  def _setup_extras() -> Dict:
94
94
  return {
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from typing import Optional
15
+ from typing import Optional, Union
16
16
 
17
17
  import torch
18
18
  from compressed_tensors.transform import TransformArgs, TransformScheme
@@ -22,7 +22,7 @@ from compressed_tensors.transform.utils.utils import (
22
22
  apply_transform_weight,
23
23
  get_matrix_size,
24
24
  )
25
- from compressed_tensors.utils import get_offloaded_device
25
+ from compressed_tensors.utils import get_execution_device, get_offloaded_device
26
26
  from compressed_tensors.utils.helpers import ParameterizedDefaultDict
27
27
  from torch import Tensor, device, dtype
28
28
  from torch.nn import Linear, Module, Parameter
@@ -41,6 +41,7 @@ class HadamardFactory(TransformFactory):
41
41
  def __init__(self, name: str, scheme: TransformScheme, seed: Optional[int] = None):
42
42
  super().__init__(name, scheme, seed)
43
43
  self.weights = ParameterizedDefaultDict(self._create_weight)
44
+ self.perms = ParameterizedDefaultDict(self._create_permutation)
44
45
 
45
46
  def create_transform(self, module: Module, args: TransformArgs):
46
47
  """
@@ -54,26 +55,46 @@ class HadamardFactory(TransformFactory):
54
55
  size = get_matrix_size(module, args.location)
55
56
  dtype = module.weight.dtype
56
57
  device = get_offloaded_device(module)
58
+ exec_device = get_execution_device(module)
57
59
 
58
- weight = self.weights[size, dtype, device]
59
- return HadamardTransform(weight, args)
60
+ factory_kwargs = {"construct_device": exec_device}
61
+ weight = self.weights.get(size, dtype, device, factory_kwargs=factory_kwargs)
62
+ perm = self.perms[weight] if self.scheme.randomize else None
63
+ return HadamardTransform(weight, perm, args)
60
64
 
61
- def _create_weight(self, size: int, dtype: dtype, device: device) -> Parameter:
62
- data = deterministic_hadamard_matrix(size, dtype, device)
63
- data = data.to(dtype=dtype, device=device)
65
+ def _create_weight(
66
+ self,
67
+ size: int,
68
+ dtype: dtype,
69
+ device: device,
70
+ construct_device: device,
71
+ ) -> Parameter:
72
+ # construct on execution device, cache on offload device
73
+ data = deterministic_hadamard_matrix(size, dtype, construct_device)
74
+ data = data.to(device=device)
64
75
  return Parameter(data, requires_grad=self.scheme.requires_grad)
65
76
 
77
+ def _create_permutation(self, weight: Parameter) -> Parameter:
78
+ data = torch.randperm(weight.size(0), generator=self.generator)
79
+ return Parameter(data, requires_grad=False)
80
+
66
81
 
67
82
  class HadamardTransform(TransformBase):
68
- def __init__(self, weight: Parameter, args: TransformArgs):
83
+ def __init__(
84
+ self, weight: Parameter, perm: Union[Parameter, None], args: TransformArgs
85
+ ):
69
86
  super().__init__()
70
87
  self.weight = weight
88
+ self.perm = perm
71
89
  self.args = args
72
90
 
73
91
  def forward(self, value: Tensor) -> Tensor:
74
- if not self.args.inverse:
75
- weight = self.weight
76
- else:
77
- weight = self.weight.T
92
+ weight = self.weight
93
+
94
+ if self.perm is not None:
95
+ weight = weight[self.perm][:, self.perm]
96
+
97
+ if self.args.inverse:
98
+ weight = weight.T
78
99
 
79
100
  return apply_transform_weight(weight, value, self.args.location)
@@ -62,6 +62,7 @@ class RandomMatrixFactory(TransformFactory):
62
62
  return RandomMatrixTransform(weight, args)
63
63
 
64
64
  def _create_weight(self, size: int, dtype: dtype, device: device) -> Parameter:
65
+ # TODO: verify that weight is invertible (has non-zero determinant)
65
66
  data = torch.rand(
66
67
  (size, size), generator=self.generator, dtype=dtype, device=device
67
68
  )
@@ -28,7 +28,14 @@ class RandomHadamardFactory(HadamardFactory):
28
28
  :param seed: random seed used to transform weight randomization
29
29
  """
30
30
 
31
- def _create_weight(self, size: int, dtype: dtype, device: device) -> Parameter:
32
- data = random_hadamard_matrix(size, dtype, device, self.generator)
33
- data = data.to(dtype=dtype, device=device)
31
+ def _create_weight(
32
+ self,
33
+ size: int,
34
+ dtype: dtype,
35
+ device: device,
36
+ construct_device: device,
37
+ ) -> Parameter:
38
+ # construct on execution device, cache on offload device
39
+ data = random_hadamard_matrix(size, dtype, construct_device, self.generator)
40
+ data = data.to(device=device)
34
41
  return Parameter(data, requires_grad=self.scheme.requires_grad)
@@ -49,7 +49,7 @@ QUIP = TransformConfig(
49
49
  inverse=True,
50
50
  ),
51
51
  ],
52
- randomize_modules=True,
52
+ randomize=True,
53
53
  ),
54
54
  "u": TransformScheme(
55
55
  type="hadamard",
@@ -62,7 +62,7 @@ QUIP = TransformConfig(
62
62
  targets=["Linear"], location="output", inverse=True # non-mergable
63
63
  ),
64
64
  ],
65
- randomize_modules=True,
65
+ randomize=True,
66
66
  ),
67
67
  }
68
68
  )
@@ -31,13 +31,12 @@ class TransformScheme(BaseModel):
31
31
  (see `Transforms.registered_names()`)
32
32
  :param apply: list of TransformationArgs containing the information about the
33
33
  modules that should be targeted by the specified transform
34
- :param randomize_modules: True if unique transforms should be applied to each
35
- unique module targeted by `apply`, otherwise reuse transform weights where
36
- applicable
34
+ :param randomize: True if uniquely randomized transform weights should be used,
35
+ otherwise use identical transform weights where applicable
37
36
  :param requires_grad: True if weights include gradients for training
38
37
  """
39
38
 
40
39
  type: str
41
40
  apply: List[TransformArgs] = Field(default_factory=list)
42
- randomize_modules: bool = Field(default=False)
41
+ randomize: bool = Field(default=False)
43
42
  requires_grad: bool = Field(default=False)
@@ -15,10 +15,11 @@
15
15
  import contextlib
16
16
  import warnings
17
17
  from functools import wraps
18
- from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional
18
+ from typing import TYPE_CHECKING, Any, Callable, Dict, List, Mapping, Optional
19
19
 
20
20
  import numpy
21
21
  import torch
22
+ from frozendict import frozendict
22
23
  from transformers import AutoConfig
23
24
 
24
25
 
@@ -373,11 +374,23 @@ class ParameterizedDefaultDict(dict):
373
374
 
374
375
  def __init__(self, default_factory: Callable[[Any], Any]):
375
376
  self.default_factory = default_factory
377
+ self._factory_kwargs = frozendict()
376
378
 
377
- def __missing__(self, key):
379
+ def __missing__(self, key: Any) -> Any:
378
380
  if isinstance(key, tuple):
379
- value = self.default_factory(*key)
381
+ value = self.default_factory(*key, **self._factory_kwargs)
380
382
  else:
381
- value = self.default_factory(key)
383
+ value = self.default_factory(key, **self._factory_kwargs)
382
384
  self[key] = value
383
385
  return value
386
+
387
+ def get(self, *args, factory_kwargs: Mapping = frozendict()) -> Any:
388
+ """
389
+ Similar to `__getitem__`, but allows passing kwargs to factory function
390
+
391
+ :param \\*args: args whose tuple will value will be treated as key
392
+ :param factory_kwargs: keyword arguments to pass to `default_factory`
393
+ :return: dictionary entry for given key
394
+ """
395
+ with patch_attr(self, "_factory_kwargs", factory_kwargs):
396
+ return self[args]
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.10.3.a20250703'
20
+ __version__ = version = '0.10.3.a20250708'
21
21
  __version_tuple__ = version_tuple = (0, 10, 3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compressed-tensors
3
- Version: 0.10.3a20250703
3
+ Version: 0.10.3a20250708
4
4
  Summary: Library for utilization of compressed safetensors of neural network models
5
5
  Home-page: https://github.com/neuralmagic/compressed-tensors
6
6
  Author: Neuralmagic, Inc.
@@ -11,6 +11,7 @@ License-File: LICENSE
11
11
  Requires-Dist: torch>=1.7.0
12
12
  Requires-Dist: transformers
13
13
  Requires-Dist: pydantic>=2.0
14
+ Requires-Dist: frozendict
14
15
  Provides-Extra: dev
15
16
  Requires-Dist: black==22.12.0; extra == "dev"
16
17
  Requires-Dist: isort==5.8.0; extra == "dev"
@@ -1,6 +1,7 @@
1
1
  torch>=1.7.0
2
2
  transformers
3
3
  pydantic>=2.0
4
+ frozendict
4
5
 
5
6
  [accelerate]
6
7
  accelerate
@@ -24,7 +24,7 @@ def test_basic_scheme():
24
24
  type="hadamard",
25
25
  apply=[basic_args],
26
26
  )
27
- assert not scheme.randomize_modules
27
+ assert not scheme.randomize
28
28
  assert scheme.type == "hadamard"
29
29
  assert len(scheme.apply) == 1
30
30
  assert isinstance(scheme.apply[0], TransformArgs)
@@ -43,10 +43,10 @@ def test_multiple_groups_global():
43
43
  scheme = TransformScheme(
44
44
  type="hadamard",
45
45
  apply=[embedding_args, linear_args],
46
- randomize_modules=True,
46
+ randomize=True,
47
47
  )
48
48
 
49
- assert scheme.randomize_modules
49
+ assert scheme.randomize
50
50
  assert scheme.type == "hadamard"
51
51
  assert len(scheme.apply) == 2
52
52
  assert isinstance(scheme.apply[0], TransformArgs)
@@ -69,6 +69,6 @@ def test_multiple_groups():
69
69
  apply=apply,
70
70
  )
71
71
 
72
- assert not scheme.randomize_modules
72
+ assert not scheme.randomize
73
73
  assert scheme.type == "hadamard"
74
74
  assert len(scheme.apply) == 20