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

Rename AdapterConfigBase to AdapterConfig #601

Closed
wants to merge 58 commits into from

Conversation

hSterz
Copy link
Member

@hSterz hSterz commented Nov 11, 2023

No description provided.

calpt and others added 30 commits August 25, 2023 16:00
Refactoring the modeling classes so that they inherit from HuggingFace classes

Renaming our classes to ...WithAdapters
add remove test inv_adapters
hSterz and others added 25 commits August 25, 2023 16:11
This PR removes all XModelWithHeads classes and updates the notebooks
that have used these classes.
This PR updates the documentation to the new version for the sections:

- Adapter Activation and Composition
- Prediction Heads
- Embeddings

---------

Co-authored-by: Hannah Sterz <[email protected]>
…apter-hub#41)

Changed the following documentation pages:
- Adding Adapters to a Model
- Extending the Library
- Model Mixins

---------

Co-authored-by: TimoImhof <[email protected]>
This PR adjusts all example scripts so that they work again.


I deleted all Hugging Face scripts that we hadn't customized yet.

---------

Co-authored-by: TimoImhof <[email protected]>
This PR updates the example notebooks to the adapters package.
Upgrade notes:
- remove copying of model classes for GPT-2 and GPT-J due to changes to Transformers merged in huggingface/transformers#25188.
- Add extra argument to `_resize_token_embeddings()`
- Add sequence classification head to T5 & use it in adapter tests
- Fix test config of Llama
Refactors the implementation of composition blocks in the model forward
pass such that more of the logic is shared between all adapter methods.

### Changes

- Move adapter methods into new `methods` folder
- Introduce new `ComposableAdapterLayerBase` as subclass of
`AdapterLayerbase` as shared base class of all adapter methods that
support composition.
- This class provides default implementations for a couple of
composition blocks (currently `Stack`, `Parallel`, `BatchSplit`,
`Average`) which can be used by all subclasses.
- To enable these composition blocks for deriving methods, a couple of
helper methods defined in `ComposableAdapterLayerBase` must be
implemented. See
https://github.com/calpt/adapter-transformers/blob/55fdc0cbe2f695914108a9c0e208127b13bc617e/src/adapters/methods/adapter_layer_base.py#L132-L222.
- Different adapter methods require passing different inputs to each
composition block. Thus, the input states are abstracted as a
`NamedTuple` in the base class. Deriving classes should define concrete
`NamedTuple`-derived state classes. E.g., see
https://github.com/calpt/adapter-transformers/blob/55fdc0cbe2f695914108a9c0e208127b13bc617e/src/adapters/methods/bottleneck.py#L22
- Update `Split` composition block to support more than two child
blocks. Splits are defined as a list of split indices, ie. `Split("a",
"b", "c", splits=[64, 64, 64])`. **Breaking change**
- Renamings: `AdapterLayer` -> `BottleneckLayer`; `PrefixTuningShim` ->
`PrefixTuningLayer`

---------

Co-authored-by: Leon Engländer <[email protected]>
@hSterz hSterz marked this pull request as ready for review November 14, 2023 11:09
@hSterz hSterz requested a review from calpt November 14, 2023 11:09
@@ -50,6 +50,12 @@ The `adapters` library supports the configuration of adapters using [config stri
For a complete list of config strings and classes see [here](https://docs.adapterhub.ml/overview.html). We strongly recommend using the new config strings, but we will continue to support the old config strings for the time being to make the transition easier.
Note that with the config strings the coresponding adapter config classes have changed, e.g. `PfeifferConfig` -> `SeqBnConfig`.

An other consequence of this that the `AdapterConfig` class is now not only for the bottleneck adapters anymore, but the base class of all the configurations (previously `AdapterConfigBase`). Hence the function this class serves has changed. However, you can still load adapter configs with:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
An other consequence of this that the `AdapterConfig` class is now not only for the bottleneck adapters anymore, but the base class of all the configurations (previously `AdapterConfigBase`). Hence the function this class serves has changed. However, you can still load adapter configs with:
Another consequence of this that the `AdapterConfig` class is now not only for the bottleneck adapters anymore, but the base class of all the configurations (previously `AdapterConfigBase`). Hence the function this class serves has changed. However, you can still load adapter configs with:

@hSterz hSterz changed the base branch from adapters to master November 15, 2023 16:34
@hSterz hSterz closed this Nov 15, 2023
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.

4 participants