Skip to content

Commit

Permalink
Add missing aliases (#1828)
Browse files Browse the repository at this point in the history
Forgot these whoops! We need to keep the old `XXClassifier` class
aliases around so we don't break folks.
  • Loading branch information
mattdangerw authored Sep 13, 2024
1 parent dd0651e commit fce5c34
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 8 deletions.
22 changes: 22 additions & 0 deletions keras_nlp/api/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
from keras_nlp.src.models.albert.albert_text_classifier import (
AlbertTextClassifier,
)
from keras_nlp.src.models.albert.albert_text_classifier import (
AlbertTextClassifier as AlbertClassifier,
)
from keras_nlp.src.models.albert.albert_text_classifier_preprocessor import (
AlbertTextClassifierPreprocessor,
)
Expand All @@ -45,6 +48,9 @@
BertMaskedLMPreprocessor,
)
from keras_nlp.src.models.bert.bert_text_classifier import BertTextClassifier
from keras_nlp.src.models.bert.bert_text_classifier import (
BertTextClassifier as BertClassifier,
)
from keras_nlp.src.models.bert.bert_text_classifier_preprocessor import (
BertTextClassifierPreprocessor,
)
Expand Down Expand Up @@ -72,6 +78,9 @@
from keras_nlp.src.models.deberta_v3.deberta_v3_text_classifier import (
DebertaV3TextClassifier,
)
from keras_nlp.src.models.deberta_v3.deberta_v3_text_classifier import (
DebertaV3TextClassifier as DebertaV3Classifier,
)
from keras_nlp.src.models.deberta_v3.deberta_v3_text_classifier_preprocessor import (
DebertaV3TextClassifierPreprocessor,
)
Expand All @@ -93,6 +102,9 @@
from keras_nlp.src.models.distil_bert.distil_bert_text_classifier import (
DistilBertTextClassifier,
)
from keras_nlp.src.models.distil_bert.distil_bert_text_classifier import (
DistilBertTextClassifier as DistilBertClassifier,
)
from keras_nlp.src.models.distil_bert.distil_bert_text_classifier_preprocessor import (
DistilBertTextClassifierPreprocessor,
)
Expand All @@ -110,6 +122,9 @@
FNetMaskedLMPreprocessor,
)
from keras_nlp.src.models.f_net.f_net_text_classifier import FNetTextClassifier
from keras_nlp.src.models.f_net.f_net_text_classifier import (
FNetTextClassifier as FNetClassifier,
)
from keras_nlp.src.models.f_net.f_net_text_classifier_preprocessor import (
FNetTextClassifierPreprocessor,
)
Expand Down Expand Up @@ -195,6 +210,9 @@
from keras_nlp.src.models.roberta.roberta_text_classifier import (
RobertaTextClassifier,
)
from keras_nlp.src.models.roberta.roberta_text_classifier import (
RobertaTextClassifier as RobertaClassifier,
)
from keras_nlp.src.models.roberta.roberta_text_classifier_preprocessor import (
RobertaTextClassifierPreprocessor,
)
Expand All @@ -208,6 +226,7 @@
from keras_nlp.src.models.t5.t5_tokenizer import T5Tokenizer
from keras_nlp.src.models.task import Task
from keras_nlp.src.models.text_classifier import TextClassifier
from keras_nlp.src.models.text_classifier import TextClassifier as Classifier
from keras_nlp.src.models.text_classifier_preprocessor import (
TextClassifierPreprocessor,
)
Expand All @@ -225,6 +244,9 @@
from keras_nlp.src.models.xlm_roberta.xlm_roberta_text_classifier import (
XLMRobertaTextClassifier,
)
from keras_nlp.src.models.xlm_roberta.xlm_roberta_text_classifier import (
XLMRobertaTextClassifier as XLMRobertaClassifier,
)
from keras_nlp.src.models.xlm_roberta.xlm_roberta_text_classifier_preprocessor import (
XLMRobertaTextClassifierPreprocessor,
)
Expand Down
7 changes: 6 additions & 1 deletion keras_nlp/src/models/albert/albert_text_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@
from keras_nlp.src.models.text_classifier import TextClassifier


@keras_nlp_export("keras_nlp.models.AlbertTextClassifier")
@keras_nlp_export(
[
"keras_nlp.models.AlbertTextClassifier",
"keras_nlp.models.AlbertClassifier",
]
)
class AlbertTextClassifier(TextClassifier):
"""An end-to-end ALBERT model for classification tasks
Expand Down
7 changes: 6 additions & 1 deletion keras_nlp/src/models/bert/bert_text_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
from keras_nlp.src.models.text_classifier import TextClassifier


@keras_nlp_export("keras_nlp.models.BertTextClassifier")
@keras_nlp_export(
[
"keras_nlp.models.BertTextClassifier",
"keras_nlp.models.BertClassifier",
]
)
class BertTextClassifier(TextClassifier):
"""An end-to-end BERT model for classification tasks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
from keras_nlp.src.models.text_classifier import TextClassifier


@keras_nlp_export("keras_nlp.models.DebertaV3TextClassifier")
@keras_nlp_export(
[
"keras_nlp.models.DebertaV3TextClassifier",
"keras_nlp.models.DebertaV3Classifier",
]
)
class DebertaV3TextClassifier(TextClassifier):
"""An end-to-end DeBERTa model for classification tasks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
from keras_nlp.src.models.text_classifier import TextClassifier


@keras_nlp_export("keras_nlp.models.DistilBertTextClassifier")
@keras_nlp_export(
[
"keras_nlp.models.DistilBertTextClassifier",
"keras_nlp.models.DistilBertClassifier",
]
)
class DistilBertTextClassifier(TextClassifier):
"""An end-to-end DistilBERT model for classification tasks.
Expand Down
7 changes: 6 additions & 1 deletion keras_nlp/src/models/f_net/f_net_text_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
from keras_nlp.src.models.text_classifier import TextClassifier


@keras_nlp_export("keras_nlp.models.FNetTextClassifier")
@keras_nlp_export(
[
"keras_nlp.models.FNetTextClassifier",
"keras_nlp.models.FNetClassifier",
]
)
class FNetTextClassifier(TextClassifier):
"""An end-to-end f_net model for classification tasks.
Expand Down
7 changes: 6 additions & 1 deletion keras_nlp/src/models/roberta/roberta_text_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@
from keras_nlp.src.models.text_classifier import TextClassifier


@keras_nlp_export("keras_nlp.models.RobertaTextClassifier")
@keras_nlp_export(
[
"keras_nlp.models.RobertaTextClassifier",
"keras_nlp.models.RobertaClassifier",
]
)
class RobertaTextClassifier(TextClassifier):
"""An end-to-end RoBERTa model for classification tasks.
Expand Down
7 changes: 6 additions & 1 deletion keras_nlp/src/models/text_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
from keras_nlp.src.models.task import Task


@keras_nlp_export("keras_nlp.models.TextClassifier")
@keras_nlp_export(
[
"keras_nlp.models.TextClassifier",
"keras_nlp.models.Classifier",
]
)
class TextClassifier(Task):
"""Base class for all classification tasks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
)


@keras_nlp_export("keras_nlp.models.XLMRobertaTextClassifier")
@keras_nlp_export(
[
"keras_nlp.models.XLMRobertaTextClassifier",
"keras_nlp.models.XLMRobertaClassifier",
]
)
class XLMRobertaTextClassifier(TextClassifier):
"""An end-to-end XLM-RoBERTa model for classification tasks.
Expand Down

0 comments on commit fce5c34

Please sign in to comment.