-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
Mamba: add generative tests #31478
Mamba: add generative tests #31478
Conversation
@@ -250,6 +250,8 @@ def prepare_config_and_inputs_for_common(self): | |||
@require_torch | |||
class MambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): | |||
all_model_classes = (MambaModel, MambaForCausalLM) if is_torch_available() else () | |||
all_generative_model_classes = (MambaForCausalLM,) if is_torch_available() else () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests passing for mamba :)
@unittest.skip("No attention in mamba") | ||
def test_retain_grad_hidden_states_attentions(self): | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test was actually passing, just needed the has_attentions
flag
@unittest.skip("Mamba does not use attention") | ||
def test_attention_outputs(self): | ||
r""" | ||
Overriding the test_attention_outputs test as the attention outputs of Mamba are different from other models | ||
it has a shape `batch_size, seq_len, hidden_size`. | ||
""" | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has_attentions
skips this test
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful - thanks for adding. bonus points for skipping properly with skip messages ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding! Good to see some more usage of GenerationTesterMixin for non-standard models
Supercedes #31094
Fixes #30828 🤗
This PR:
mamba
has_attentions
tester flag (TIL about this flag)PreTrainedModel
--_is_stateful
(self explanatory) [note: AFAIK we only have 3 stateful models,mamba
,jamba
, andrwkv
, lmk if there are more!]_is_stateful
to set a few appropriate exceptions and test skipsNote: with
has_attentions
and_is_stateful
, I suspect I can remove a few more skips in a follow up PR :)