Skip to content

Commit 5807ee1

Browse files
committed
put on device via safe_open
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
1 parent 94a0bf5 commit 5807ee1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compressed_tensors/transform/utils/hadamard.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ def _get_known_divisor(
110110
:param n: size of known hadamard matrix
111111
:return: a known hadamard matrix of size `n` if one exists, else None
112112
"""
113-
with safe_open(file_path, framework="pt", device="cpu") as file:
113+
with safe_open(file_path, framework="pt", device=str(device)) as file:
114114
divisors = sorted([int(key) for key in file.keys()], reverse=True)
115115
for divisor in divisors:
116116
if n % divisor == 0 and is_pow2(n // divisor):
117-
return file.get_tensor(str(divisor)).to(dtype=dtype, device=device)
117+
return file.get_tensor(str(divisor)).to(dtype=dtype)
118118

119119
return None
120120

0 commit comments

Comments
 (0)