Skip to content

Commit 42acafa

Browse files
committed
Updates
1 parent 8222741 commit 42acafa

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

test/integration/test_integration.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,5 +1946,32 @@ def test_benchmark_model_cpu(self):
19461946
assert self.run_benchmark_model("cpu") is not None
19471947

19481948

1949+
# TODO: Remove this test once the deprecated API has been removed
1950+
def test_cutlass_int4_packed_layout_deprecated():
1951+
import sys
1952+
import warnings
1953+
1954+
# We need to clear the cache to force re-importing and trigger the warning again.
1955+
modules_to_clear = [
1956+
"torchao.dtypes.uintx.cutlass_int4_packed_layout",
1957+
"torchao.dtypes",
1958+
]
1959+
for mod in modules_to_clear:
1960+
if mod in sys.modules:
1961+
del sys.modules[mod]
1962+
1963+
with warnings.catch_warnings(record=True) as w:
1964+
from torchao.dtypes import CutlassInt4PackedLayout # noqa: F401
1965+
1966+
warnings.simplefilter("always") # Ensure all warnings are captured
1967+
assert any(
1968+
issubclass(warning.category, DeprecationWarning)
1969+
and "CutlassInt4PackedLayout" in str(warning.message)
1970+
for warning in w
1971+
), (
1972+
f"Expected deprecation warning for CutlassInt4PackedLayout, got: {[str(warning.message) for warning in w]}"
1973+
)
1974+
1975+
19491976
if __name__ == "__main__":
19501977
unittest.main()

test/sparsity/test_sparse_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ def test_sparse_deprecated(self):
282282
del sys.modules[mod]
283283

284284
with warnings.catch_warnings(record=True) as w:
285-
from torchao.dtypes import BlockSparseLayout
285+
from torchao.dtypes import BlockSparseLayout # noqa: F401
286+
286287
warnings.simplefilter("always") # Ensure all warnings are captured
287288
self.assertTrue(
288289
any(

torchao/dtypes/uintx/cutlass_int4_packed_layout.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
warnings.warn(
1111
"Importing from torchao.dtypes is deprecated. "
1212
"Please use 'from torchao.prototype.dtypes import CutlassInt4PackedLayout' instead. "
13-
"This import path will be removed in torchao v0.16.0.",
13+
"This import path will be removed in torchao v0.16.0. "
14+
"Please check issue: https://github.com/pytorch/ao/issues/2752 for more details. ",
1415
DeprecationWarning,
1516
stacklevel=2,
1617
)

0 commit comments

Comments
 (0)