Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion backends/cuda/tests/test_int4_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ def _make_int4_linear(N, K, group_size=128, symmetric=False, bias=False):
)
int4_w = quantize_weight(w_bf16, config)

module = nn.Linear(K, N, bias=bias, dtype=torch.bfloat16)
# device="cuda" so the random init draws from the CUDA RNG to match the
# same random weight as regular int4 dispatch and fit the same numerical
# error tolerance.
module = nn.Linear(K, N, bias=bias, dtype=torch.bfloat16, device="cuda")
pack_linear_for_cuda(module, {"weight": int4_w})
module.cuda()
return module, w_bf16.cuda()
Expand Down
Loading