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

Added warning message for failed awq_ext import to enhance error clarity #491

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions awq/modules/fused/mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
import torch.nn.functional as F
from awq.modules.linear.gemm import WQLinear_GEMM
from awq.modules.linear.gemv import WQLinear_GEMV
import warnings

try:
import awq_ext # with CUDA kernels

AWQ_INSTALLED = True
except:
except Exception as e:
AWQ_INSTALLED = False
warnings.warn(f"AWQ extension could not be imported. Error: {e}")


class QuantFusedMLP(nn.Module):
Expand Down
5 changes: 3 additions & 2 deletions awq/modules/fused/moe.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import torch
from typing import Dict
import warnings

try:
import awq_ext # with CUDA kernels

AWQ_INSTALLED = True
except:
except Exception as e:
AWQ_INSTALLED = False
warnings.warn(f"AWQ extension could not be imported. Error: {e}")


class FusedSparseMoeBlock(torch.nn.Module):
Expand Down
6 changes: 3 additions & 3 deletions awq/modules/fused/norm.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import torch
from torch import nn
import warnings

try:
import awq_ext # with CUDA kernels

AWQ_INSTALLED = True
except:
except Exception as e:
AWQ_INSTALLED = False

warnings.warn(f"AWQ extension could not be imported. Error: {e}")

class FasterTransformerRMSNorm(nn.Module):
def __init__(self, weight, eps=1e-6):
Expand Down
7 changes: 4 additions & 3 deletions awq/modules/linear/gemm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
from torch.autograd import Function
from awq.utils.utils import get_best_device
from awq.utils.packing_utils import dequantize_gemm
import warnings

try:
import awq_ext # with CUDA kernels (AutoAWQ_kernels)

import awq_ext # with CUDA kernels
AWQ_INSTALLED = True
except:
except Exception as e:
AWQ_INSTALLED = False
warnings.warn(f"AWQ extension could not be imported. Error: {e}")


# Adapted from https://github.com/compressa-ai/AutoAWQ/tree/dev
Expand Down
6 changes: 3 additions & 3 deletions awq/modules/linear/gemv.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import torch
import torch.nn as nn
import warnings

try:
import awq_ext # with CUDA kernels

AWQ_INSTALLED = True
except:
except Exception as e:
AWQ_INSTALLED = False

warnings.warn(f"AWQ extension could not be imported. Error: {e}")

def make_divisible(c, divisor):
return (c + divisor - 1) // divisor
Expand Down