fix code
This commit is contained in:
parent
97d22be58c
commit
344467f2b8
2 changed files with 6 additions and 2 deletions
|
@ -1417,7 +1417,7 @@ class BitnetModel(Model):
|
|||
def weight_quant(self, weight):
|
||||
dtype = weight.dtype
|
||||
weight = weight.float()
|
||||
s = 1 / weight.abs().mean().clamp(min=1e-5)
|
||||
s = 1 / weight.abs().mean().clamp(min=1e-5)
|
||||
result = (weight * s).round().clamp(-1, 1) / s
|
||||
return result.type(dtype)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue