Skip to content

Commit

Permalink
Fix various issues with 16b data type handling (pytorch#161)
Browse files Browse the repository at this point in the history
* tab->spc

* quantize

* remove extraneous conversion
  • Loading branch information
mikekgfb authored and malfet committed Jul 17, 2024
1 parent 423f939 commit 33928a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/compile-bf16.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
echo "******************************************"
echo "******** INT4 group-wise quantized *******"
echo "******************************************"
if [ ${DTYPE} == float16 ]; then
if [ ${DTYPE} == float16 ]; then
DTYPE=bfloat16
fi

Expand All @@ -115,6 +115,6 @@ jobs:
cat ./output_aoti

echo "tests complete for ${DTYPE}"
done
echo "tests complete for all dtypes!"
done
echo "tests complete for all dtypes!"
4 changes: 2 additions & 2 deletions quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,12 +756,12 @@ def __init__(
# MKG: torch.float
self.register_buffer(
"scales_and_zeros",
torch.empty((in_features // groupsize, out_features, 2), dtype=torch.float)
torch.empty((in_features // groupsize, out_features, 2), dtype=get_precision())
)

def forward(self, input: torch.Tensor) -> torch.Tensor:
# MKG torch.float
input = input.to(torch.float)
# input = input.to(torch.float)
if self.padding:
import torch.nn.functional as F
input = F.pad(input, pad=(0, self.in_features - self.origin_in_features))
Expand Down

0 comments on commit 33928a8

Please sign in to comment.