compressed-tensors 0.10.3a20250724__tar.gz → 0.10.3a20250728__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.
- {compressed_tensors-0.10.3a20250724/src/compressed_tensors.egg-info → compressed_tensors-0.10.3a20250728}/PKG-INFO +1 -1
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/lifecycle/forward.py +8 -4
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/lifecycle/initialize.py +7 -5
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/quant_scheme.py +4 -3
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/factory/hadamard.py +6 -5
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/utils/match.py +12 -7
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/version.py +1 -1
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728/src/compressed_tensors.egg-info}/PKG-INFO +1 -1
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_utils/test_match.py +68 -29
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.github/.gitkeep +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.github/actions/test/action.yml +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.github/scripts/step-status +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.github/workflows/build-test.yml +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.github/workflows/build.yml +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.github/workflows/report.yml +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.github/workflows/test-check.yaml +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.github/workflows/test.yml +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.github/workflows/trigger-all.yml +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.github/workflows/upload.yml +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.gitignore +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/LICENSE +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/Makefile +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/README.md +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/examples/bit_packing/ex_quantize_and_pack.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/examples/bit_packing/int4_config.json +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/examples/bitmask_compression.ipynb +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/examples/llama_1.1b/ex_config_quantization.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/examples/llama_1.1b/ex_llmcompressor_quantization.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/examples/llama_1.1b/example_quant_config.json +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/examples/llama_1.1b/example_quant_recipe.yaml +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/examples/quantize_and_pack_int4.ipynb +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/pyproject.toml +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/setup.cfg +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/setup.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/README.md +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/base.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/base.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/helpers.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/model_compressors/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/model_compressors/model_compressor.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/quantized_compressors/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/quantized_compressors/base.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/quantized_compressors/naive_quantized.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/quantized_compressors/nvfp4_quantized.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/quantized_compressors/pack_quantized.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/sparse_compressors/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/sparse_compressors/base.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/sparse_compressors/dense.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/sparse_compressors/sparse_24_bitmask.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/sparse_compressors/sparse_bitmask.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/sparse_quantized_compressors/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/compressors/sparse_quantized_compressors/marlin_24.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/config/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/config/base.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/config/dense.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/config/sparse_24_bitmask.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/config/sparse_bitmask.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/linear/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/linear/compressed_linear.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/lifecycle/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/lifecycle/apply.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/lifecycle/compressed.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/lifecycle/helpers.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/quant_args.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/quant_config.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/utils/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/quantization/utils/helpers.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/registry/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/registry/registry.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/apply.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/factory/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/factory/base.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/factory/matrix_multiply.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/factory/random_hadamard.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/transform_args.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/transform_config.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/transform_scheme.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/utils/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/utils/hadamard.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/utils/hadamards.safetensors +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/transform/utils/matrix.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/utils/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/utils/helpers.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/utils/internal.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/utils/offload.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/utils/permutations_24.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/utils/permute.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/utils/safetensors_load.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors/utils/semi_structured_conversions.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors.egg-info/SOURCES.txt +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors.egg-info/dependency_links.txt +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors.egg-info/requires.txt +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/src/compressed_tensors.egg-info/top_level.txt +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/conftest.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/model_compressors/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/model_compressors/test_model_compressor.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/quantized_compressors/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/quantized_compressors/test_fp8_quant.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/quantized_compressors/test_int_quant.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/quantized_compressors/test_nvfp4_quant.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/quantized_compressors/test_pack_quant.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/sparse_compressors/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/sparse_compressors/test_bitmask.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/sparse_compressors/test_sparse_24_bitmask.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/sparse_quantized_compressors/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_compressors/sparse_quantized_compressors/test_marlin_24.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_configs/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_configs/test_base.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_examples/test_bitmask_compression_ipynb.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_linear/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_linear/test_compressed_linear.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/lifecycle/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/lifecycle/conftest.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/lifecycle/test_apply.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/lifecycle/test_dynamic_lifecycle.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/lifecycle/test_enabled.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/lifecycle/test_forward.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/lifecycle/test_helpers.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/lifecycle/test_initialize.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/lifecycle/test_lifecycle.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/test_configs/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/test_configs/test_bit_depths.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/test_configs/test_strategies.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/test_quant_args.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/test_quant_config.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/test_quant_scheme.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_quantization/test_utils/test_helpers.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_registry.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_transform/conftest.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_transform/factory/test_correctness.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_transform/factory/test_memory.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_transform/test_transform_args.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_transform/test_transform_config.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_transform/test_transform_scheme.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_transform/utils/test_hadamard.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_utils/__init__.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_utils/test_helpers.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_utils/test_offload.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_utils/test_safetensors_load.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/testing_utils.py +0 -0
- {compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/utils/copyright.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: compressed-tensors
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.3a20250728
|
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.
|
@@ -112,17 +112,21 @@ def dequantize(
|
|
112
112
|
if scale.shape[1] == 1:
|
113
113
|
args = QuantizationArgs(strategy=QuantizationStrategy.CHANNEL)
|
114
114
|
# Scale height matches input or is 1 -> group quantization across columns
|
115
|
-
#
|
115
|
+
#
|
116
116
|
# Example 1: scale.shape[0] == 1
|
117
117
|
# x_q: (4, 8), scale: (1, 4) -> 2 columns per group
|
118
118
|
#
|
119
|
-
# Example 2: scale.shape[0] == x_q.shape[0]
|
119
|
+
# Example 2: scale.shape[0] == x_q.shape[0]
|
120
120
|
# x_q: (4, 8), scale: (4, 4) -> 2 elements per group (per row)
|
121
121
|
elif (scale.shape[0] == 1) or (scale.shape[0] == x_q.shape[0]):
|
122
122
|
group_size = int(x_q.shape[1] / scale.shape[1])
|
123
|
-
args = QuantizationArgs(
|
123
|
+
args = QuantizationArgs(
|
124
|
+
strategy=QuantizationStrategy.GROUP, group_size=group_size
|
125
|
+
)
|
124
126
|
else:
|
125
|
-
args = QuantizationArgs(
|
127
|
+
args = QuantizationArgs(
|
128
|
+
strategy=QuantizationStrategy.BLOCK, block_structure=scale.shape
|
129
|
+
)
|
126
130
|
else:
|
127
131
|
raise ValueError(
|
128
132
|
f"Could not infer a quantization strategy from scale with {scale.ndim} "
|
@@ -185,27 +185,29 @@ def _initialize_scale_zero_point(
|
|
185
185
|
elif quantization_args.strategy == QuantizationStrategy.BLOCK:
|
186
186
|
# For block quantization, scale shape should match number of blocks - only for weights
|
187
187
|
if quantization_args.block_structure is None:
|
188
|
-
raise ValueError(
|
188
|
+
raise ValueError(
|
189
|
+
"Block quantization requires block_structure to be specified"
|
190
|
+
)
|
189
191
|
block_height, block_width = quantization_args.block_structure
|
190
192
|
rows, cols = weight_shape[-2], weight_shape[-1]
|
191
193
|
num_rows_blocks = math.ceil(rows / block_height)
|
192
194
|
num_cols_blocks = math.ceil(cols / block_width)
|
193
|
-
|
195
|
+
|
194
196
|
# Warn if dimensions don't divide evenly
|
195
197
|
if rows % block_height != 0 or cols % block_width != 0:
|
196
198
|
warnings.warn(
|
197
199
|
f"Block quantization: tensor shape {weight_shape} does not divide evenly "
|
198
200
|
f"by block structure {quantization_args.block_structure}. "
|
199
201
|
f"Some blocks will be incomplete which may affect quantization quality.",
|
200
|
-
UserWarning
|
202
|
+
UserWarning,
|
201
203
|
)
|
202
|
-
|
204
|
+
|
203
205
|
expected_shape = (num_rows_blocks, num_cols_blocks)
|
204
206
|
elif quantization_args.strategy == QuantizationStrategy.BLOCK:
|
205
207
|
warnings.warn(
|
206
208
|
f"BLOCK quantization not supported for {base_name} activations. "
|
207
209
|
f"Falling back to tensor-level quantization.",
|
208
|
-
UserWarning
|
210
|
+
UserWarning,
|
209
211
|
)
|
210
212
|
expected_shape = 1
|
211
213
|
|
@@ -64,8 +64,9 @@ class QuantizationScheme(BaseModel):
|
|
64
64
|
raise ValueError("Cannot apply actorder to output activations")
|
65
65
|
|
66
66
|
if (
|
67
|
-
inputs
|
68
|
-
and weights
|
67
|
+
inputs
|
68
|
+
and weights
|
69
|
+
and weights.strategy == QuantizationStrategy.GROUP
|
69
70
|
and inputs.strategy == QuantizationStrategy.GROUP
|
70
71
|
and weights.group_size != inputs.group_size
|
71
72
|
):
|
@@ -75,7 +76,7 @@ class QuantizationScheme(BaseModel):
|
|
75
76
|
"may complicate fused kernel implementations. Consider using "
|
76
77
|
"TENSOR_GROUP strategy for both or matching group sizes.",
|
77
78
|
UserWarning,
|
78
|
-
stacklevel=2
|
79
|
+
stacklevel=2,
|
79
80
|
)
|
80
81
|
|
81
82
|
return model
|
@@ -12,9 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
import math
|
15
16
|
from typing import Optional, Union
|
16
17
|
|
17
|
-
import math
|
18
18
|
import torch
|
19
19
|
from compressed_tensors.transform import TransformArgs, TransformScheme
|
20
20
|
from compressed_tensors.transform.factory.base import TransformBase, TransformFactory
|
@@ -103,7 +103,8 @@ class HadamardTransform(TransformBase):
|
|
103
103
|
|
104
104
|
if self.args.inverse:
|
105
105
|
weight = weight.T
|
106
|
-
|
107
|
-
return
|
108
|
-
weight, value, self.args.location, self.module_type
|
109
|
-
|
106
|
+
|
107
|
+
return (
|
108
|
+
apply_transform_weight(weight, value, self.args.location, self.module_type)
|
109
|
+
/ self._scale
|
110
|
+
)
|
@@ -18,6 +18,7 @@ from collections.abc import Generator
|
|
18
18
|
from typing import Iterable, Tuple
|
19
19
|
|
20
20
|
import torch
|
21
|
+
from compressed_tensors.utils.internal import InternalModule
|
21
22
|
|
22
23
|
|
23
24
|
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
@@ -28,8 +29,6 @@ __all__ = [
|
|
28
29
|
"match_named_parameters",
|
29
30
|
"match_modules_set",
|
30
31
|
"is_match",
|
31
|
-
"match_name",
|
32
|
-
"match_class",
|
33
32
|
]
|
34
33
|
|
35
34
|
|
@@ -83,13 +82,16 @@ def match_named_parameters(
|
|
83
82
|
"""
|
84
83
|
unmatched_targets = set(targets)
|
85
84
|
for module_name, module in model.named_modules():
|
85
|
+
if isinstance(module, InternalModule):
|
86
|
+
continue
|
87
|
+
|
86
88
|
for param_name, param in module.named_parameters(recurse=False):
|
87
89
|
param_fqn = f"{module_name}.{param_name}"
|
88
90
|
for target in targets:
|
89
|
-
if
|
91
|
+
if _match_name(param_fqn, target):
|
90
92
|
unmatched_targets -= {target}
|
91
93
|
|
92
|
-
if not any(
|
94
|
+
if not any(_match_name(param_fqn, ign) for ign in ignore):
|
93
95
|
yield param_fqn, module, param
|
94
96
|
|
95
97
|
if warn_on_fail:
|
@@ -165,11 +167,14 @@ def match_modules_set(
|
|
165
167
|
def is_match(name: str, module: torch.nn.Module, target: str) -> bool:
|
166
168
|
"""
|
167
169
|
Returns true if either module name or module parent classes match against target
|
170
|
+
and the module is not an internal module
|
168
171
|
"""
|
169
|
-
return
|
172
|
+
return not isinstance(module, InternalModule) and (
|
173
|
+
_match_name(name, target) or _match_class(module, target)
|
174
|
+
)
|
170
175
|
|
171
176
|
|
172
|
-
def
|
177
|
+
def _match_name(name: str, target: str) -> bool:
|
173
178
|
"""
|
174
179
|
Returns true if target string begins with "re:" and
|
175
180
|
regex matches or if target string exactly matches name
|
@@ -180,7 +185,7 @@ def match_name(name: str, target: str) -> bool:
|
|
180
185
|
return target == name
|
181
186
|
|
182
187
|
|
183
|
-
def
|
188
|
+
def _match_class(module: torch.nn.Module, target: str) -> bool:
|
184
189
|
"""
|
185
190
|
Returns true if any torch parent class names match the target string exactly
|
186
191
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: compressed-tensors
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.3a20250728
|
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.
|
@@ -19,14 +19,14 @@ import torch.nn as nn
|
|
19
19
|
from accelerate import init_empty_weights
|
20
20
|
|
21
21
|
# Assuming the module is named "module_matching" - adjust import as needed
|
22
|
-
from compressed_tensors.utils
|
22
|
+
from compressed_tensors.utils import (
|
23
|
+
InternalModule,
|
23
24
|
is_match,
|
24
|
-
match_class,
|
25
25
|
match_modules_set,
|
26
|
-
match_name,
|
27
26
|
match_named_modules,
|
28
27
|
match_named_parameters,
|
29
28
|
)
|
29
|
+
from compressed_tensors.utils.match import _match_class, _match_name
|
30
30
|
|
31
31
|
|
32
32
|
class DummyModel(nn.Module):
|
@@ -66,14 +66,14 @@ class DummyModel(nn.Module):
|
|
66
66
|
|
67
67
|
|
68
68
|
class TestMatchName:
|
69
|
-
"""Test cases for
|
69
|
+
"""Test cases for _match_name function"""
|
70
70
|
|
71
71
|
def test_exact_match(self):
|
72
72
|
"""Test exact string matching"""
|
73
|
-
assert
|
74
|
-
assert
|
73
|
+
assert _match_name("layer1", "layer1") == True
|
74
|
+
assert _match_name("layer1", "layer2") == False
|
75
75
|
assert (
|
76
|
-
|
76
|
+
_match_name(
|
77
77
|
"transformer.layers.0.self_attn.q_proj",
|
78
78
|
"transformer.layers.0.self_attn.q_proj",
|
79
79
|
)
|
@@ -82,14 +82,14 @@ class TestMatchName:
|
|
82
82
|
|
83
83
|
def test_regex_match(self):
|
84
84
|
"""Test regex matching with "re:" prefix"""
|
85
|
-
assert
|
86
|
-
assert
|
87
|
-
assert
|
85
|
+
assert _match_name("layer1", "re:layer.*") == True
|
86
|
+
assert _match_name("layer1", "re:^layer1$") == True
|
87
|
+
assert _match_name("layer1", "re:layer2") == False
|
88
88
|
assert (
|
89
|
-
|
89
|
+
_match_name("transformer.layers.0.self_attn.q_proj", "re:.*q_proj") == True
|
90
90
|
)
|
91
91
|
assert (
|
92
|
-
|
92
|
+
_match_name(
|
93
93
|
"transformer.layers.0.self_attn.q_proj",
|
94
94
|
"re:transformer\\.layers\\.\\d+\\.self_attn\\..*_proj$",
|
95
95
|
)
|
@@ -98,49 +98,49 @@ class TestMatchName:
|
|
98
98
|
|
99
99
|
def test_empty_strings(self):
|
100
100
|
"""Test edge cases with empty strings"""
|
101
|
-
assert
|
102
|
-
assert
|
103
|
-
assert
|
101
|
+
assert _match_name("", "") == True
|
102
|
+
assert _match_name("layer1", "") == False
|
103
|
+
assert _match_name("", "layer1") == False
|
104
104
|
|
105
105
|
def test_regex_special_characters(self):
|
106
106
|
"""Test regex with special characters"""
|
107
|
-
assert
|
108
|
-
assert
|
109
|
-
assert
|
107
|
+
assert _match_name("layer.1", "re:layer\\.1") == True
|
108
|
+
assert _match_name("layer.1", "re:layer.1") == True # . matches any char
|
109
|
+
assert _match_name("layer_1", "re:layer_1") == True
|
110
110
|
|
111
111
|
|
112
112
|
class TestMatchClass:
|
113
|
-
"""Test cases for
|
113
|
+
"""Test cases for _match_class function"""
|
114
114
|
|
115
115
|
def test_direct_class_match(self):
|
116
116
|
"""Test matching direct class names"""
|
117
117
|
linear = nn.Linear(10, 20)
|
118
|
-
assert
|
119
|
-
assert
|
118
|
+
assert _match_class(linear, "Linear") == True
|
119
|
+
assert _match_class(linear, "Conv2d") == False
|
120
120
|
|
121
121
|
norm = nn.LayerNorm(10)
|
122
|
-
assert
|
123
|
-
assert
|
122
|
+
assert _match_class(norm, "LayerNorm") == True
|
123
|
+
assert _match_class(norm, "BatchNorm1d") == False
|
124
124
|
|
125
125
|
def test_parent_class_match(self):
|
126
126
|
"""Test matching parent class names"""
|
127
127
|
linear = nn.Linear(10, 20)
|
128
|
-
assert
|
128
|
+
assert _match_class(linear, "Module") == True
|
129
129
|
|
130
130
|
conv = nn.Conv2d(3, 16, 3)
|
131
|
-
assert
|
132
|
-
assert
|
131
|
+
assert _match_class(conv, "Module") == True
|
132
|
+
assert _match_class(conv, "_ConvNd") == True
|
133
133
|
|
134
134
|
def test_non_torch_module(self):
|
135
135
|
"""Test with non-torch modules"""
|
136
136
|
regular_object = object()
|
137
|
-
assert
|
137
|
+
assert _match_class(regular_object, "object") == False # not a torch.nn.Module
|
138
138
|
|
139
139
|
def test_custom_module(self):
|
140
140
|
"""Test with custom module classes"""
|
141
141
|
model = DummyModel()
|
142
|
-
assert
|
143
|
-
assert
|
142
|
+
assert _match_class(model, "DummyModel") == True
|
143
|
+
assert _match_class(model, "Module") == True
|
144
144
|
|
145
145
|
|
146
146
|
class TestIsMatch:
|
@@ -171,6 +171,15 @@ class TestIsMatch:
|
|
171
171
|
assert is_match("layer1", linear, "re:layer.*") == True
|
172
172
|
assert is_match("layer1", linear, "re:conv.*") == False
|
173
173
|
|
174
|
+
def test_internal_module_match(self):
|
175
|
+
"""Test not matching internal modules"""
|
176
|
+
|
177
|
+
class InternalLinear(InternalModule, nn.Linear):
|
178
|
+
pass
|
179
|
+
|
180
|
+
linear = InternalLinear(10, 20)
|
181
|
+
assert is_match("layer1", linear, "re:layer.*") == False
|
182
|
+
|
174
183
|
|
175
184
|
class TestMatchNamedModules:
|
176
185
|
"""Test cases for match_named_modules function"""
|
@@ -236,6 +245,16 @@ class TestMatchNamedModules:
|
|
236
245
|
assert "Could not match" in warning_msg
|
237
246
|
assert "nonexistent_module" in warning_msg
|
238
247
|
|
248
|
+
def test_internal_match(self):
|
249
|
+
"""Test not matching internal modules"""
|
250
|
+
|
251
|
+
class InternalLinear(InternalModule, nn.Linear):
|
252
|
+
pass
|
253
|
+
|
254
|
+
linear = InternalLinear(10, 20)
|
255
|
+
matches = list(match_named_modules(linear, ["re:.*"]))
|
256
|
+
assert len(matches) == 0
|
257
|
+
|
239
258
|
|
240
259
|
class TestMatchNamedParameters:
|
241
260
|
"""Test cases for match_named_parameters function"""
|
@@ -298,6 +317,16 @@ class TestMatchNamedParameters:
|
|
298
317
|
assert "Could not match" in warning_msg
|
299
318
|
assert "nonexistent.param" in warning_msg
|
300
319
|
|
320
|
+
def test_internal_match(self):
|
321
|
+
"""Test not matching internal modules"""
|
322
|
+
|
323
|
+
class InternalLinear(InternalModule, nn.Linear):
|
324
|
+
pass
|
325
|
+
|
326
|
+
linear = InternalLinear(10, 20)
|
327
|
+
matches = list(match_named_parameters(linear, ["re:.*"]))
|
328
|
+
assert len(matches) == 0
|
329
|
+
|
301
330
|
|
302
331
|
class TestMatchModulesSet:
|
303
332
|
"""Test cases for match_modules_set function"""
|
@@ -377,6 +406,16 @@ class TestMatchModulesSet:
|
|
377
406
|
# Should have 2 sets (layers 1 and 2, but not 0)
|
378
407
|
assert len(matches) == 2
|
379
408
|
|
409
|
+
def test_internal_match(self):
|
410
|
+
"""Test not matching internal modules"""
|
411
|
+
|
412
|
+
class InternalLinear(InternalModule, nn.Linear):
|
413
|
+
pass
|
414
|
+
|
415
|
+
linear = InternalLinear(10, 20)
|
416
|
+
matches = list(match_modules_set(linear, ["re:.*"]))
|
417
|
+
assert len(matches) == 0
|
418
|
+
|
380
419
|
|
381
420
|
class TestIntegration:
|
382
421
|
"""Integration tests combining multiple functions"""
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/.github/workflows/test.yml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/test_registry.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/tests/testing_utils.py
RENAMED
File without changes
|
{compressed_tensors-0.10.3a20250724 → compressed_tensors-0.10.3a20250728}/utils/copyright.py
RENAMED
File without changes
|