From 38c8fb2b131d284aa6d17955eab39a49d5b14285 Mon Sep 17 00:00:00 2001 From: Zhongzhu Zhou Date: Sun, 27 Aug 2023 23:16:45 +0800 Subject: [PATCH] Update gptq.py In calculation, it seems you use percentage to do the calculation. Thus, when new input comes, the tmp seems to be the number of input, the percentage shall be tmp/nsamples and then *2. It seems you defaultly set tmp = 1 in the code. --- gptq.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gptq.py b/gptq.py index 1fa90c4..9a609a2 100644 --- a/gptq.py +++ b/gptq.py @@ -53,8 +53,8 @@ def add_batch(self, inp, out): self.H *= self.nsamples / (self.nsamples + tmp) self.nsamples += tmp # inp = inp.float() - inp = math.sqrt(2 / self.nsamples) * inp.float() - # self.H += 2 / self.nsamples * inp.matmul(inp.t()) + inp = math.sqrt(2*tmp / self.nsamples) * inp.float() + # self.H += 2*tmp / self.nsamples * inp.matmul(inp.t()) self.H += inp.matmul(inp.t()) def fasterquant(