-
Notifications
You must be signed in to change notification settings - Fork 243
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
keep getting error regarding missing positional argument 'attention_mask' #690
Comments
++ |
Transformers 4.48.0 broke a lot of packages that rely on transformers. Downgrade to 4.47.1 to fix it |
Any idea what the issue is yet? 4.47.1 is working for me so far (not finished quantizing yet) but I'm assuming eventually you plan to modify your source code to comport with their new API? |
If it helps, I found a comment in some code at the unsloth repository that seems to pertain to this issue...might be a good place to look for how they addressed the issue: I'm specifically referring to the code that reads as follows:
|
@casper-hansen I think this might be a good starting point and save you some time... |
Hi, this error is caused by diff --git a/awq/quantize/quantizer.py b/awq/quantize/quantizer.py
index 28280b0..c6f1b54 100644
--- a/awq/quantize/quantizer.py
+++ b/awq/quantize/quantizer.py
@@ -584,9 +584,11 @@ class AwqQuantizer:
except ValueError: # work with early exit
pass
modules[0] = modules[0].module # restore
+ has_attention_mask = "attention_mask" in layer_kwargs
# Update the layer kwargs with `prepare_inputs_for_generation` method
# that takes care of everything to avoid unexpected errors.
+ # NOTE: After this function, `attention_mask` is removed from `layer_kwargs`. BUT `attention_mask` is catched by Catcher.
layer_kwargs = self.model.prepare_inputs_for_generation(samples, **layer_kwargs)
# Pop the input_ids as they are not needed at all.
layer_kwargs.pop("input_ids")
@@ -603,6 +605,8 @@ class AwqQuantizer:
layer_kwargs["attention_mask"] = layer_kwargs["attention_mask"].to(
best_device
)
+ elif has_attention_mask:
+ layer_kwargs["attention_mask"] =None
return modules, layer_kwargs, inps PS: This fix is not pretty good, because |
Thanks dude, I tried looking for the core issue but got frustrated after a few hours. Hopefully @casper-hansen gets around to responding and/or updating his codebase. |
I've downgraded Transformers to 4.47.1 but now I get the following error:
The model is open-thoughts/OpenThinker-32B, which is Qwen-based. |
I've tried various troubleshooting steps but can't seem to resolve the following error:
The text was updated successfully, but these errors were encountered: