Skip to content

Commit

Permalink
fix nf4 to cpu (#12722)
Browse files Browse the repository at this point in the history
  • Loading branch information
MeouSker77 authored Jan 21, 2025
1 parent 9aa4be8 commit 085974e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions python/llm/src/ipex_llm/transformers/low_bit_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,15 @@ def ggml_q_format_convet_cpu2xpu(tensor: torch.Tensor, num_elem: int, qtype: int


def ggml_q_format_convet_xpu2cpu(tensor: torch.Tensor, num_elem: int, qtype: int):

invalidInputError(tensor.dtype == torch.uint8,
"Input tensor must be uint8")
if qtype == NF4:
invalidInputError(tensor.dtype == torch.bfloat16,
"NF4 Input tensor must be bfloat16")
else:
invalidInputError(tensor.dtype == torch.uint8,
"Input tensor must be uint8")

invalidInputError(tensor.device == torch.device('cpu'),
"Input tensor must be uint8")
"Input tensor must be on cpu")

src = ctypes.c_void_p(tensor.data.data_ptr())

Expand Down

0 comments on commit 085974e

Please sign in to comment.