Skip to content

Commit

Permalink
Final cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
calpt committed Jan 6, 2022
1 parent d7345ef commit 2f9e3f9
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 15 deletions.
1 change: 0 additions & 1 deletion src/transformers/models/bart/modeling_bart.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from torch.nn import CrossEntropyLoss, MSELoss

from ...activations import ACT2FN
from ...adapters.context import AdapterSetup
from ...adapters.model_mixin import InvertibleAdaptersMixin, ModelWithHeadsAdaptersMixin
from ...adapters.models.bart import (
BartDecoderLayerAdaptersMixin,
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/distilbert/modeling_distilbert.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import gelu
from ...adapters.context import AdapterSetup
from ...adapters.model_mixin import ModelWithHeadsAdaptersMixin
from ...adapters.models.distilbert import (
DistilBertModelAdaptersMixin,
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/gpt2/modeling_gpt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
is_amp_available = False

from ...activations import ACT2FN
from ...adapters.context import AdapterSetup
from ...adapters.model_mixin import ModelWithHeadsAdaptersMixin
from ...adapters.models.gpt2 import GPT2DecoderBlockAdaptersMixin, GPT2ModelAdapterMixin, GPT2ModelHeadsMixin
from ...file_utils import (
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/mbart/modeling_mbart.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from torch.nn import CrossEntropyLoss, MSELoss

from ...activations import ACT2FN
from ...adapters.context import AdapterSetup
from ...adapters.model_mixin import InvertibleAdaptersMixin, ModelWithHeadsAdaptersMixin
from ...adapters.models.bart import (
BartDecoderLayerAdaptersMixin,
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/t5/modeling_t5.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from torch.utils.checkpoint import checkpoint

from ...activations import ACT2FN
from ...adapters.context import AdapterSetup
from ...adapters.model_mixin import InvertibleAdaptersMixin, ModelWithHeadsAdaptersMixin
from ...adapters.models.t5 import (
T5BlockAdaptersMixin,
Expand Down
11 changes: 1 addition & 10 deletions utils/check_adapters.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import inspect

import transformers
from check_repo import get_models
from transformers import ModelAdaptersMixin, ModelWithFlexibleHeadsAdaptersMixin
from transformers import ModelAdaptersMixin


MODELS_WITH_ADAPTERS = [
Expand Down Expand Up @@ -41,13 +39,6 @@ def check_models_implement_mixin():
and model_name not in IGNORE_NOT_IMPLEMENTING_MIXIN
):
failures.append(f"{model_name} should implement ModelAdaptersMixin.")
forward_fn_params = inspect.signature(model_class.forward).parameters
# all classes implementing ModelWithFlexibleHeadsAdaptersMixin should additionally provide adapter_names as parameter
if (
issubclass(model_class, ModelWithFlexibleHeadsAdaptersMixin)
and "adapter_names" not in forward_fn_params
):
failures.append(f"{model_name}'s forward() method should provide adapter_names parameter.")
if len(failures) > 0:
raise Exception(f"There were {len(failures)} failures:\n" + "\n".join(failures))

Expand Down

0 comments on commit 2f9e3f9

Please sign in to comment.