GPTQ Env vars: catch correct type of error (#596)

# What does this PR do?

When passing in environment variables like gptq_bits, we still get
errors thrown from TGI because the try/catch block is catching the wrong
type of error. This PR aims to fix that.

@Narsil - let me know if this is how you want this formatted. My Python
is a little shaky, so I hope this syntax is correct.
This commit is contained in:
ssmi153 2023-07-13 01:57:46 +08:00 committed by GitHub
parent f2f0289fb9
commit 3628559516
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -130,7 +130,7 @@ class Weights:
try:
bits = self.get_tensor("gptq_bits").item()
groupsize = self.get_tensor("gptq_groupsize").item()
except SafetensorError as e:
except (SafetensorError, RuntimeError) as e:
try:
import os
@ -159,7 +159,7 @@ class Weights:
try:
bits = self.get_tensor("gptq_bits").item()
groupsize = self.get_tensor("gptq_groupsize").item()
except SafetensorError as e:
except (SafetensorError, RuntimeError) as e:
try:
import os