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

Large model class refactoring: Introduce ...AdapterModel classes #289

Merged
merged 11 commits into from
Feb 23, 2022

Conversation

calpt
Copy link
Member

@calpt calpt commented Feb 16, 2022

What does this PR do?

This PR performs a whole series of refactorings to...

... model classes:

  • move all additionally introduced model classes out of the original modeling_X.py modules into separate modules in transformers.adapters.models
  • move all mixins to transformers.adapters.mixins
  • introduce XAdapterModel classes as replacement for XModelWithHeads classes to provide a clearly identified single go-to class for all adapter-related features.
  • deprecate all XModelWithHeads classes
  • integrate the prediction head definitions formerly in XModelHeadsMixin into XAdapterModel to simplify implementations

... tests:

  • move all tests required for adapter-transformers to the new tests_adapters folder. It's therefore sufficient to only run tests in this folder for CI.
  • refactor test classes such that each supported model has exactly one test module in tests_adapters that defines both the model test class (XAdapterModelTest) as well as all adapter test classes (XAdapterTest).

.... documentation:

  • update model class docs to only show autodoc for XAdapterModel classes. All other class docs can be obtained from HF
  • add a model overview page
  • replace mentions of XModelWithHeads with XAdapterModel

... misc:

  • add an additional __init__.py to allow all adapter-related classes to be imported via transformers.adapters
  • update the adding_adapters_to_a_model guide

@calpt calpt marked this pull request as ready for review February 17, 2022 22:07
@calpt calpt requested a review from hSterz February 17, 2022 22:08
@JoPfeiff
Copy link
Member

🥳

Copy link
Member

@hSterz hSterz left a comment

Choose a reason for hiding this comment

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

Looks good

adapter_docs/model_overview.md Outdated Show resolved Hide resolved
@calpt calpt merged commit a106fde into adapter-hub:develop Feb 23, 2022
@calpt calpt deleted the dev/model_classes branch February 23, 2022 08:52
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.

3 participants