Skip to content

Commit 05af947

Browse files
committed
add torch_npu version assertion and show downstream testing result
1 parent ca8f056 commit 05af947

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ TorchAO is an easy to use quantization library for native PyTorch. TorchAO works
6060

6161
Check out our [docs](https://docs.pytorch.org/ao/main/) for more details!
6262

63+
## Third-party Pipeline Status
64+
65+
| Backend | Inference |
66+
| ---------- | ------------------------------------------------------------ |
67+
| Ascend NPU | [![Ascend NPU](https://github.com/Ascend/Ascend-CI/actions/workflows/torchao.yml/badge.svg)]( |
68+
6369
## 🚀 Quick Start
6470

6571
First, install TorchAO. We recommend installing the latest stable version:

torchao/quantization/quantize_/workflows/int4/int4_plain_int32_tensor.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,12 @@ def _from_hp_npu(
163163
w: torch.Tensor,
164164
block_size: List[int],
165165
):
166-
# Require PyTorch 2.7.1+ for NPU backend ops and backward compatibility.
167-
assert torch_version_at_least("2.7.1"), (
168-
"Need pytorch 2.7.1+ for NPU backend op support."
166+
assert (
167+
torch.accelerator.is_available()
168+
and torch.accelerator.current_accelerator().type == "npu"
169+
and torch_version_at_least("2.7.1")
170+
), (
171+
f"PyTorch NPU 2.7.1+ needed for int4 packing and matmul ops, {torch.__version__} found"
169172
)
170173

171174
assert w.ndim == 2 and w.device.type == "npu", (

0 commit comments

Comments
 (0)