Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibly a bug when checking if awq_ext is installed #461

Closed
BenjaminBossan opened this issue Apr 26, 2024 · 2 comments · Fixed by #465
Closed

Possibly a bug when checking if awq_ext is installed #461

BenjaminBossan opened this issue Apr 26, 2024 · 2 comments · Fixed by #465

Comments

@BenjaminBossan
Copy link

Regarding these lines:

try:
import awq_ext # with CUDA kernels (AutoAWQ_kernels)
AWQ_INSTALLED = True
except:
AWQ_INSTALLED = False

and

if awq_ext is None:

It seems that either, in the first block awq_ext = None should be set or in the second, if AWQ_INSTALLED should be checked.

Also just a small note, try: import foo; except ... can be dangerous as the import can trigger side-effects, though it's not super likely, just something to be aware of.

@casper-hansen
Copy link
Owner

Hi @BenjaminBossan, thanks for raising this issue. Just trying to understand what you are thinking. Would the following be better?

AWQ_INSTALLED = None
 try: 
     import awq_ext  # with CUDA kernels (AutoAWQ_kernels) 
  
     AWQ_INSTALLED = True 
 except: 
     AWQ_INSTALLED = False 

@BenjaminBossan
Copy link
Author

Solution 1, l.12:

try:
    import awq_ext  # with CUDA kernels (AutoAWQ_kernels)

    AWQ_INSTALLED = True
except:
    AWQ_INSTALLED = False
+   awq_ext = None

or solution 2, line 66:

-        if awq_ext is None:
+        if not AWQ_INSTALLED:

Otherwise, we get a name error in l.66 if awq_ext could not be imported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants