Skip to content

Commit

Permalink
update to version 1.3.9 support newest transformers.
Browse files Browse the repository at this point in the history
  • Loading branch information
shibing624 committed May 22, 2024
1 parent f1a7150 commit 58e955c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 435 deletions.
2 changes: 1 addition & 1 deletion pytextclassifier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@author:XuMing(xuming624@qq.com)
@description:
"""
__version__ = '1.3.8'
__version__ = '1.3.9'

from pytextclassifier.classic_classifier import ClassicClassifier
from pytextclassifier.fasttext_classifier import FastTextClassifier
Expand Down
39 changes: 1 addition & 38 deletions pytextclassifier/bert_classification_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,13 @@
BertTokenizer,
BertweetTokenizer,
DistilBertConfig,
DistilBertTokenizer,
ElectraConfig,
ElectraTokenizer,
HerbertTokenizer,
LongformerConfig,
LongformerTokenizer,
RobertaConfig,
RobertaTokenizer,
XLMConfig,
XLMRobertaConfig,
XLMRobertaTokenizer,
XLMTokenizer,
XLNetConfig,
XLNetTokenizer,
Expand All @@ -91,6 +87,7 @@
get_cosine_with_hard_restarts_schedule_with_warmup,
get_polynomial_decay_schedule_with_warmup,
)

sys.path.append('..')
from pytextclassifier.bert_classfication_utils import (
BertClassificationArgs,
Expand All @@ -104,13 +101,8 @@
from pytextclassifier.bert_multi_label_classification_model import (
AlbertForMultiLabelSequenceClassification,
BertForMultiLabelSequenceClassification,
BertweetForMultiLabelSequenceClassification,
DistilBertForMultiLabelSequenceClassification,
ElectraForMultiLabelSequenceClassification,
LongformerForMultiLabelSequenceClassification,
RobertaForMultiLabelSequenceClassification,
XLMForMultiLabelSequenceClassification,
XLMRobertaForMultiLabelSequenceClassification,
XLNetForMultiLabelSequenceClassification
)

Expand All @@ -124,16 +116,12 @@
MODELS_WITHOUT_CLASS_WEIGHTS_SUPPORT = ["deberta", "mpnet"]

MODELS_WITH_EXTRA_SEP_TOKEN = [
"roberta",
"camembert",
"xlmroberta",
"longformer",
"mpnet",
]

MODELS_WITH_ADD_PREFIX_SPACE = [
"roberta",
"camembert",
"xlmroberta",
"longformer",
"mpnet",
Expand Down Expand Up @@ -187,21 +175,6 @@ def __init__(
BertForMultiLabelSequenceClassification,
BertTokenizer,
),
"bertweet": (
RobertaConfig,
BertweetForMultiLabelSequenceClassification,
BertweetTokenizer,
),
"distilbert": (
DistilBertConfig,
DistilBertForMultiLabelSequenceClassification,
DistilBertTokenizer,
),
"electra": (
ElectraConfig,
ElectraForMultiLabelSequenceClassification,
ElectraTokenizer,
),
"herbert": (
BertConfig,
BertForMultiLabelSequenceClassification,
Expand All @@ -212,17 +185,7 @@ def __init__(
LongformerForMultiLabelSequenceClassification,
LongformerTokenizer,
),
"roberta": (
RobertaConfig,
RobertaForMultiLabelSequenceClassification,
RobertaTokenizer,
),
"xlm": (XLMConfig, XLMForMultiLabelSequenceClassification, XLMTokenizer),
"xlmroberta": (
XLMRobertaConfig,
XLMRobertaForMultiLabelSequenceClassification,
XLMRobertaTokenizer,
),
"xlnet": (
XLNetConfig,
XLNetForMultiLabelSequenceClassification,
Expand Down
Loading

0 comments on commit 58e955c

Please # to comment.