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

fix dynamic_cuda validation #936

Merged
merged 1 commit into from
Dec 20, 2024
Merged
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
7 changes: 7 additions & 0 deletions gptqmodel/nn_modules/qlinear/dynamic_cuda.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# License: GPTQModel/licenses/LICENSE.apache
from typing import Tuple, Optional

import torch

Expand Down Expand Up @@ -67,6 +68,12 @@ def __init__(

assert infeatures % 64 == 0 and outfeatures % 64 == 0

@classmethod
def validate(cls, **args) -> Tuple[bool, Optional[Exception]]:
if gptqmodel_cuda_import_exception is not None:
return False, gptqmodel_cuda_import_exception
return cls._validate(**args)

def forward(self, x: torch.Tensor):
out_shape = x.shape[:-1] + (self.outfeatures,)
x = x.reshape(-1, x.shape[-1])
Expand Down