Skip to content

Commit

Permalink
Robust quantization for Catcher (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
casper-hansen authored Nov 20, 2023
1 parent e440c7a commit 63d2aae
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions awq/quantize/quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,16 @@ def __init__(self, module):
super().__init__()
self.module = module

def forward(self, hijacked_inputs, **kwargs):
inps.append(hijacked_inputs)
def forward(self, *args, **kwargs):
# assume first input to forward is hidden states
if len(args) > 0:
hidden_states = args[0]
del args
else:
first_key = list(kwargs.keys())[0]
hidden_states = kwargs.pop(first_key)

inps.append(hidden_states)
layer_kwargs.update(kwargs)
raise ValueError # early exit to break later inference

Expand Down

0 comments on commit 63d2aae

Please sign in to comment.