Skip to content

Conversation

@yonigozlan
Copy link
Member

What does this PR do?

Add support for inheritance from class with different suffix in modular, fixes #33900 (comment)

Useful when we want to create a model for a certain task, extending another model used for a different task, as is the case for ColPaliForRetrieval and PaliGemmaForConditionalGeneration in #33736

Not sure if that's in the spirit of modular or if it's the best way to do this though!

Fixes #33900

Who can review?

cc @ArthurZucker , @tonywu71

@yonigozlan yonigozlan marked this pull request as ready for review October 10, 2024 18:42
Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall sounds good, I applied similar changes here: a2a6a9b which you have probably seen!

Can you try to import them (ex: raise the error earlier, use camel case replace, no old_class_name and new_class_name for simplification etc)

and most importantly, work with a dummy example this way we can see exactly what you are enabling.

Hardest cases are when you inherit from CLIPMLP or CLIPTextAttention for MyModelAttention

@yonigozlan yonigozlan force-pushed the add-support-different-suffix-modular branch from 9fb8b1a to b73f446 Compare October 13, 2024 15:09
@yonigozlan
Copy link
Member Author

No I hadn't seen those changes sorry about that, I have added them now.
Also added a dummy example very similar to what we're trying to do with ColPali!

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup nice thanks for updating! 🤗 LGTM

@yonigozlan yonigozlan merged commit 6544271 into huggingface:main Oct 15, 2024
7 of 9 checks passed
@tonywu71 tonywu71 mentioned this pull request Oct 16, 2024
16 tasks
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
…ar (huggingface#34077)

* add support for different suffix in modular

* add dummy example, pull new changes for modular

* nide lines order change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modular converter ignores my Config and my ModelOutput classes

2 participants