Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
AutoGPTQ
Commits
7721a587
Commit
7721a587
authored
Nov 28, 2024
by
yangql
Browse files
Update gptq.py
parent
e8e27350
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
19 deletions
+3
-19
auto_gptq/quantization/gptq.py
auto_gptq/quantization/gptq.py
+3
-19
No files found.
auto_gptq/quantization/gptq.py
View file @
7721a587
...
...
@@ -113,25 +113,9 @@ 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
)
H
=
torch
.
linalg
.
cholesky
(
H
)
H
=
torch
.
cholesky_inverse
(
H
)
H
=
torch
.
linalg
.
cholesky
(
H
,
upper
=
True
)
Hinv
=
H
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment