Commit 7721a587 authored by yangql's avatar yangql
Browse files

Update gptq.py

parent e8e27350
......@@ -113,26 +113,10 @@ class GPTQ:
damp = percdamp * torch.mean(torch.diag(H))
diag = torch.arange(self.columns, device=self.dev)
H[diag, diag] += damp
try:
H = torch.linalg.cholesky(H)
H = torch.cholesky_inverse(H)
H = torch.linalg.cholesky(H, upper=True)
except torch._C._LinAlgError as e:
import pdb
pdb.set_trace()
print("Cholesky decomposition failed: ", e)
epsilon = 1e-3
# 添加一个小的对角线偏移以增强正定性
H += epsilon * torch.eye(H.size(0), device=H.get_device())
H = torch.linalg.cholesky(H)
H = torch.cholesky_inverse(H)
H = torch.linalg.cholesky(H, upper=True)
Hinv = H
for i1 in range(0, self.columns, blocksize):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment