--- title: modeling.token_classification keywords: fastai sidebar: home_sidebar summary: "This module contains custom models, loss functions, custom splitters, etc... for token classification tasks like named entity recognition." description: "This module contains custom models, loss functions, custom splitters, etc... for token classification tasks like named entity recognition." nb_path: "nbs/02a_modeling-token-classification.ipynb" ---
{% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}
torch.cuda.set_device(1)
print(f'Using GPU #{torch.cuda.current_device()}: {torch.cuda.get_device_name()}')
Using GPU #1: GeForce GTX 1080 Ti
{% endraw %}

Token classification

The objective of token classification is to predict the correct label for each token provided in the input. In the computer vision world, this is akin to what we do in segmentation tasks whereby we attempt to predict the class/label for each pixel in an image. Named entity recognition (NER) is an example of token classification in the NLP space

{% raw %}
df_converters = {'tokens': ast.literal_eval, 'labels': ast.literal_eval, 'nested-labels': ast.literal_eval}

# full nlp dataset
# germ_eval_df = pd.read_csv('./data/task-token-classification/germeval2014ner_cleaned.csv', converters=df_converters)

# demo nlp dataset
germ_eval_df = pd.read_csv('./germeval2014_sample.csv', converters=df_converters)

print(len(germ_eval_df))
germ_eval_df.head()
1000
id source tokens labels nested-labels ds_type
0 0 n-tv.de vom 26.02.2005 [2005-02-26] [Schartau, sagte, dem, ", Tagesspiegel, ", vom, Freitag, ,, Fischer, sei, ", in, einer, Weise, aufgetreten, ,, die, alles, andere, als, überzeugend, war, ", .] [B-PER, O, O, O, B-ORG, O, O, O, O, B-PER, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O] [O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O] train
1 1 welt.de vom 29.10.2005 [2005-10-29] [Firmengründer, Wolf, Peter, Bree, arbeitete, Anfang, der, siebziger, Jahre, als, Möbelvertreter, ,, als, er, einen, fliegenden, Händler, aus, dem, Libanon, traf, .] [O, B-PER, I-PER, I-PER, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, B-LOC, O, O] [O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O] train
2 2 http://www.stern.de/sport/fussball/krawalle-in-der-fussball-bundesliga-dfb-setzt-auf-falsche-konzepte-1553657.html#utm_source=standard&utm_medium=rss-feed&utm_campaign=sport [2010-03-25] [Ob, sie, dabei, nach, dem, Runden, Tisch, am, 23., April, in, Berlin, durch, ein, pädagogisches, Konzept, unterstützt, wird, ,, ist, allerdings, zu, bezweifeln, .] [O, O, O, O, O, O, O, O, O, O, O, B-LOC, O, O, O, O, O, O, O, O, O, O, O, O] [O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O] train
3 3 stern.de vom 21.03.2006 [2006-03-21] [Bayern, München, ist, wieder, alleiniger, Top-, Favorit, auf, den, Gewinn, der, deutschen, Fußball-Meisterschaft, .] [B-ORG, I-ORG, O, O, O, O, O, O, O, O, O, B-LOCderiv, O, O] [B-LOC, B-LOC, O, O, O, O, O, O, O, O, O, O, O, O] train
4 4 http://www.fr-online.de/in_und_ausland/sport/aktuell/1618625_Frings-schaut-finster-in-die-Zukunft.html [2008-10-24] [Dabei, hätte, der, tapfere, Schlussmann, allen, Grund, gehabt, ,, sich, viel, früher, aufzuregen, .] [O, O, O, O, O, O, O, O, O, O, O, O, O, O] [O, O, O, O, O, O, O, O, O, O, O, O, O, O] train
{% endraw %}

We are only going to be working with small sample from the GermEval 2014 data set ... so the results might not be all that great :).

{% raw %}
labels = sorted(list(set([lbls for sublist in germ_eval_df.labels.tolist() for lbls in sublist])))
print(labels)
['B-LOC', 'B-LOCderiv', 'B-LOCpart', 'B-ORG', 'B-ORGpart', 'B-OTH', 'B-OTHderiv', 'B-OTHpart', 'B-PER', 'B-PERderiv', 'B-PERpart', 'I-LOC', 'I-LOCderiv', 'I-ORG', 'I-ORGpart', 'I-OTH', 'I-PER', 'O']
{% endraw %} {% raw %}
model_cls = AutoModelForTokenClassification
pretrained_model_name = "bert-base-multilingual-cased"
config = AutoConfig.from_pretrained(pretrained_model_name)

config.num_labels = len(labels)
{% endraw %}

Notice above how I set the config.num_labels attribute to the number of labels we want our model to be able to predict. The model will update its last layer accordingly (this concept is essentially transfer learning).

{% raw %}
hf_arch, hf_config, hf_tokenizer, hf_model = BLURR.get_hf_objects(pretrained_model_name, 
                                                                  model_cls=model_cls, 
                                                                  config=config)
hf_arch, type(hf_config), type(hf_tokenizer), type(hf_model)
('bert',
 transformers.models.bert.configuration_bert.BertConfig,
 transformers.models.bert.tokenization_bert_fast.BertTokenizerFast,
 transformers.models.bert.modeling_bert.BertForTokenClassification)
{% endraw %} {% raw %}
test_eq(hf_config.num_labels, len(labels))
{% endraw %} {% raw %}
before_batch_tfm = HF_TokenClassBeforeBatchTransform(hf_arch, hf_config, hf_tokenizer, hf_model,
                                                     is_split_into_words=True, 
                                                     tok_kwargs={ 'return_special_tokens_mask': True })

blocks = (
    HF_TextBlock(before_batch_tfm=before_batch_tfm, input_return_type=HF_TokenClassInput), 
    HF_TokenCategoryBlock(vocab=labels)
)

def get_y(inp):
    return [ (label, len(hf_tokenizer.tokenize(str(entity)))) for entity, label in zip(inp.tokens, inp.labels) ]

dblock = DataBlock(blocks=blocks, 
                   get_x=ColReader('tokens'),
                   get_y=get_y,
                   splitter=RandomSplitter())
{% endraw %}

We have to define a get_y that creates the same number of labels as there are subtokens for a particular token. For example, my name "Wayde" gets split up into two subtokens, "Way" and "##de". The label for "Wayde" is "B-PER" and we just repeat it for the subtokens. This all get cleaned up when we show results and get predictions.

{% raw %}
dls = dblock.dataloaders(germ_eval_df, bs=2)
{% endraw %} {% raw %}
dls.show_batch(dataloaders=dls, max_n=2)
token / target label
0 [('Helbig', 'B-OTH'), ('et', 'I-OTH'), ('al.', 'I-OTH'), ('(', 'O'), ('1994', 'O'), (')', 'O'), ('S.', 'O'), ('593.', 'O'), ('Wink', 'O'), ('&', 'B-OTH'), ('Seibold', 'I-OTH'), ('et', 'I-OTH'), ('al.', 'I-OTH'), ('(', 'I-OTH'), ('1998', 'O'), (')', 'O'), ('S.', 'O'), ('32', 'O'), ('Inwieweit', 'O'), ('noch', 'O'), ('andere', 'O'), ('Falken,', 'O'), ('wie', 'O'), ('der', 'O'), ('Afrikanische', 'O'), ('Baumfalke', 'O'), ('(', 'O'), ('Falco', 'B-LOCderiv'), ('cuvieri', 'O'), (')', 'O'), ('oder', 'O'), ('der', 'O'), ('Malaienbaumfalke', 'O'), ('(', 'O'), ('Falco', 'O'), ('serverus', 'O'), (')', 'O'), ('dieser', 'O'), ('Gruppe', 'O'), ('zuzuzählen', 'O'), ('sind,', 'O'), ('ist', 'O'), ('Gegenstand', 'O'), ('der', 'O'), ('Forschung.', 'O')]
1 [('Außerdem', 'O'), ('befindet', 'O'), ('sich', 'O'), ('im', 'O'), ('Nordwesten', 'O'), ('der', 'O'), ('Stadt', 'O'), ('(', 'O'), ('auf', 'O'), ('dem', 'O'), ('Gelände', 'O'), ('des', 'O'), ('ehemaligen', 'O'), ('Militärflughafens', 'O'), ('Butzweilerhof', 'B-LOC'), (')', 'O'), ('das', 'O'), ('Coloneum,', 'B-LOC'), ('Europas', 'O'), ('größter', 'B-LOC'), ('Studiokomplex', 'O'), ('mit', 'O'), ('einer', 'O'), ('Fläche', 'O'), ('von', 'O'), ('35', 'O'), ('ha', 'O'), ('und', 'O'), ('20', 'O'), ('Studios', 'O'), ('(', 'O'), ('25.', 'O'), ('000', 'O'), ('m²', 'O'), (')', 'O'), ('mit', 'O'), ('bis', 'O'), ('zu', 'O'), ('30', 'O'), ('Meter', 'O'), ('Deckenhöhe.', 'O')]
{% endraw %}

Metrics

In this section, we'll add helpful metrics for token classification tasks

{% raw %}

calculate_token_class_metrics[source]

calculate_token_class_metrics(pred_toks, targ_toks, metric_key)

{% endraw %} {% raw %}
{% endraw %}

Training

{% raw %}
 
{% endraw %} {% raw %}
 
{% endraw %} {% raw %}
 
{% endraw %} {% raw %}
 
{% endraw %} {% raw %}
 
{% endraw %} {% raw %}

class HF_TokenClassMetricsCallback[source]

HF_TokenClassMetricsCallback(tok_metrics=['accuracy', 'precision', 'recall', 'f1'], **kwargs) :: Callback

A fastai friendly callback that includes accuracy, precision, recall, and f1 metrics using the seqeval library. Additionally, this metric knows how to not include your 'ignore_token' in it's calculations.

See here for more information on seqeval.

{% endraw %} {% raw %}
{% endraw %} {% raw %}
model = HF_BaseModelWrapper(hf_model)
learn_cbs = [HF_BaseModelCallback]
fit_cbs = [HF_TokenClassMetricsCallback()]

learn = Learner(dls, model, opt_func=partial(Adam),cbs=learn_cbs,splitter=hf_splitter)

learn.freeze()
{% endraw %} {% raw %}
 
{% endraw %} {% raw %}
b = dls.one_batch()
preds = learn.model(b[0])
len(preds),preds[0].shape
(1, torch.Size([2, 76, 18]))
{% endraw %} {% raw %}
len(b), len(b[0]), b[0]['input_ids'].shape, len(b[1]), b[1].shape
(2, 3, torch.Size([2, 76]), 2, torch.Size([2, 76]))
{% endraw %} {% raw %}
print(preds[0].view(-1, preds[0].shape[-1]).shape, b[1].view(-1).shape)
test_eq(preds[0].view(-1, preds[0].shape[-1]).shape[0], b[1].view(-1).shape[0])
torch.Size([152, 18]) torch.Size([152])
{% endraw %} {% raw %}
print(len(learn.opt.param_groups))
3
{% endraw %} {% raw %}
learn.unfreeze()
learn.lr_find(suggestions=True)
SuggestedLRs(lr_min=0.0013182567432522773, lr_steep=6.30957365501672e-05)
{% endraw %} {% raw %}
learn.fit_one_cycle(1, lr_max= 3e-5, moms=(0.8,0.7,0.8), cbs=fit_cbs)
epoch train_loss valid_loss accuracy precision recall f1 time
0 0.152308 0.195174 0.943240 0.517123 0.541219 0.528897 00:34
/home/wgilliam/anaconda3/envs/blurr/lib/python3.7/site-packages/seqeval/metrics/v1.py:57: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples. Use `zero_division` parameter to control this behavior.
  _warn_prf(average, modifier, msg_start, len(result))
{% endraw %} {% raw %}
print(learn.token_classification_report)
              precision    recall  f1-score   support

         LOC       0.80      0.47      0.59       119
    LOCderiv       0.21      1.00      0.35         6
     LOCpart       0.00      0.00      0.00         0
         ORG       0.46      0.40      0.43        78
     ORGpart       0.00      0.00      0.00         0
         OTH       0.03      0.14      0.05         7
     OTHpart       0.00      0.00      0.00         0
         PER       0.88      0.83      0.85        69
    PERderiv       0.00      0.00      0.00         0
     PERpart       0.00      0.00      0.00         0

   micro avg       0.52      0.54      0.53       279
   macro avg       0.24      0.28      0.23       279
weighted avg       0.69      0.54      0.59       279

{% endraw %}

Showing results

Below we'll add in additional functionality to more intuitively show the results of our model.

{% raw %}
{% endraw %} {% raw %}
learn.show_results(learner=learn, max_n=2, trunc_at=10)
token / target label / predicted label
0 [('Zugang', 'O', 'O'), ('und', 'O', 'O'), ('Engagement', 'O', 'O'), (':', 'O', 'O'), ('das', 'O', 'O'), ('eigentlich', 'O', 'O'), ('Neue', 'O', 'O'), ('an', 'O', 'O'), ('der', 'O', 'O'), ('Netz', 'O', 'O')]
1 [('Eine', 'O', 'O'), ('Sonderform', 'O', 'O'), ('der', 'O', 'O'), ('reduplizierten', 'O', 'O'), ('Komposita', 'O', 'O'), ('sind', 'O', 'O'), ('die', 'O', 'O'), ('sogenannten', 'O', 'O'), ('Echowörter,', 'O', 'O'), ('bei', 'O', 'O')]
{% endraw %} {% raw %}
res = learn.blurr_predict('My name is Wayde and I live in San Diego'.split())
print(res[0][0])
("['O', 'O', 'O', 'O', 'B-PER', 'B-PER', 'O', 'O', 'O', 'O', 'B-LOC', 'B-LOC', 'O']",)
{% endraw %}

The default Learner.predict method returns a prediction per subtoken, including the special tokens for each architecture's tokenizer.

{% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}

Learner.blurr_predict_tokens[source]

Learner.blurr_predict_tokens(items, **kargs)

{% endraw %} {% raw %}
txt ="Hi! My name is Wayde Gilliam from ohmeow.com. I live in California."
txt2 = "I wish covid was over so I could go to Germany and watch Bayern Munich play in the Bundesliga."
{% endraw %} {% raw %}
res = learn.blurr_predict_tokens(txt.split())
for r in res: print(f'{[(tok, lbl) for tok,lbl in zip(r[0],r[1]) ]}\n')
[('Hi!', 'O'), ('My', 'O'), ('name', 'O'), ('is', 'O'), ('Wayde', 'B-PER'), ('Gilliam', 'I-PER'), ('from', 'O'), ('ohmeow.com.', 'O'), ('I', 'O'), ('live', 'O'), ('in', 'O'), ('California.', 'B-LOC')]

{% endraw %} {% raw %}
res = learn.blurr_predict_tokens([txt.split(), txt2.split()])
for r in res: print(f'{[(tok, lbl) for tok,lbl in zip(r[0],r[1]) ]}\n')
[('Hi!', 'O'), ('My', 'O'), ('name', 'O'), ('is', 'O'), ('Wayde', 'B-PER'), ('Gilliam', 'I-PER'), ('from', 'O'), ('ohmeow.com.', 'O'), ('I', 'O'), ('live', 'O'), ('in', 'O'), ('California.', 'B-LOC')]

[('I', 'O'), ('wish', 'O'), ('covid', 'O'), ('was', 'O'), ('over', 'O'), ('so', 'O'), ('I', 'O'), ('could', 'O'), ('go', 'O'), ('to', 'O'), ('Germany', 'B-LOC'), ('and', 'O'), ('watch', 'O'), ('Bayern', 'B-ORG'), ('Munich', 'B-ORG'), ('play', 'O'), ('in', 'O'), ('the', 'O'), ('Bundesliga.', 'B-ORG')]

{% endraw %}

It's interesting (and very cool) how well this model performs on English even thought it was trained against a German corpus.

Inference

{% raw %}
export_fname = 'tok_class_learn_export'
{% endraw %} {% raw %}
learn.export(fname=f'{export_fname}.pkl')
inf_learn = load_learner(fname=f'{export_fname}.pkl')

res = learn.blurr_predict_tokens([txt.split(), txt2.split()])
for r in res: print(f'{[(tok, lbl) for tok,lbl in zip(r[0],r[1]) ]}\n')
[('Hi!', 'O'), ('My', 'O'), ('name', 'O'), ('is', 'O'), ('Wayde', 'B-PER'), ('Gilliam', 'I-PER'), ('from', 'O'), ('ohmeow.com.', 'O'), ('I', 'O'), ('live', 'O'), ('in', 'O'), ('California.', 'B-LOC')]

[('I', 'O'), ('wish', 'O'), ('covid', 'O'), ('was', 'O'), ('over', 'O'), ('so', 'O'), ('I', 'O'), ('could', 'O'), ('go', 'O'), ('to', 'O'), ('Germany', 'B-LOC'), ('and', 'O'), ('watch', 'O'), ('Bayern', 'B-ORG'), ('Munich', 'B-ORG'), ('play', 'O'), ('in', 'O'), ('the', 'O'), ('Bundesliga.', 'B-ORG')]

{% endraw %}

... and onnx

{% raw %}
# @patch
# def predict_tokens(self:blurrONNX, items, **kargs):
#     hf_before_batch_tfm = get_blurr_tfm(self.dls.before_batch)
#     return _blurr_predict_tokens(self.predict, items, hf_before_batch_tfm)
{% endraw %} {% raw %}
# learn.blurr_to_onnx(export_fname, quantize=True)
{% endraw %} {% raw %}
# onnx_inf = blurrONNX(export_fname)
{% endraw %} {% raw %}
# res = onnx_inf.predict_tokens(txt.split())
# for r in res: print(f'{[(tok, lbl) for tok,lbl in zip(r[0],r[1]) ]}\n')
{% endraw %}

Tests

The tests below to ensure the token classification training code above works for all pretrained token classification models available in huggingface. These tests are excluded from the CI workflow because of how long they would take to run and the amount of data that would be required to download.

Note: Feel free to modify the code below to test whatever pretrained token classification models you are working with ... and if any of your pretrained token classification models fail, please submit a github issue (or a PR if you'd like to fix it yourself)

{% raw %}
try: del learn; torch.cuda.empty_cache()
except: pass
{% endraw %} {% raw %}
[ model_type for model_type in BLURR.get_models(task='TokenClassification') 
 if (not model_type.__name__.startswith('TF')) ]
[transformers.models.albert.modeling_albert.AlbertForTokenClassification,
 transformers.models.bert.modeling_bert.BertForTokenClassification,
 transformers.models.big_bird.modeling_big_bird.BigBirdForTokenClassification,
 transformers.models.camembert.modeling_camembert.CamembertForTokenClassification,
 transformers.models.convbert.modeling_convbert.ConvBertForTokenClassification,
 transformers.models.deberta.modeling_deberta.DebertaForTokenClassification,
 transformers.models.deberta_v2.modeling_deberta_v2.DebertaV2ForTokenClassification,
 transformers.models.distilbert.modeling_distilbert.DistilBertForTokenClassification,
 transformers.models.electra.modeling_electra.ElectraForTokenClassification,
 transformers.models.flaubert.modeling_flaubert.FlaubertForTokenClassification,
 transformers.models.funnel.modeling_funnel.FunnelForTokenClassification,
 transformers.models.ibert.modeling_ibert.IBertForTokenClassification,
 transformers.models.layoutlm.modeling_layoutlm.LayoutLMForTokenClassification,
 transformers.models.longformer.modeling_longformer.LongformerForTokenClassification,
 transformers.models.mpnet.modeling_mpnet.MPNetForTokenClassification,
 transformers.models.mobilebert.modeling_mobilebert.MobileBertForTokenClassification,
 transformers.models.roberta.modeling_roberta.RobertaForTokenClassification,
 transformers.models.squeezebert.modeling_squeezebert.SqueezeBertForTokenClassification,
 transformers.models.xlm.modeling_xlm.XLMForTokenClassification,
 transformers.models.xlm_roberta.modeling_xlm_roberta.XLMRobertaForTokenClassification,
 transformers.models.xlnet.modeling_xlnet.XLNetForTokenClassification]
{% endraw %} {% raw %}
pretrained_model_names = [
    'albert-base-v1',
    'bert-base-multilingual-cased',
    'camembert-base',
    'distilbert-base-uncased',
    'google/electra-small-discriminator',
    'flaubert/flaubert_small_cased',
    'huggingface/funnel-small-base',
    'allenai/longformer-base-4096',
    'microsoft/mpnet-base',
    'google/mobilebert-uncased',
    'roberta-base',
    'squeezebert/squeezebert-uncased',
    'xlm-mlm-en-2048',
    'xlm-roberta-base',
    'xlnet-base-cased'
]
{% endraw %} {% raw %}
#hide_output
model_cls = AutoModelForTokenClassification
bsz = 4
seq_sz = 64

test_results = []
for model_name in pretrained_model_names:
    error=None
    
    print(f'=== {model_name} ===\n')
    
    config = AutoConfig.from_pretrained(model_name)
    config.num_labels = len(labels)
    
    hf_arch, hf_config, hf_tokenizer, hf_model = BLURR.get_hf_objects(model_name, 
                                                                      model_cls=model_cls, 
                                                                      config=config)
    
    print(f'architecture:\t{hf_arch}\ntokenizer:\t{type(hf_tokenizer).__name__}\n')
    
    # not all architectures include a native pad_token (e.g., gpt2, ctrl, etc...), so we add one here
    if (hf_tokenizer.pad_token is None): 
        hf_tokenizer.add_special_tokens({'pad_token': '<pad>'})  
        hf_config.pad_token_id = hf_tokenizer.get_vocab()['<pad>']
        hf_model.resize_token_embeddings(len(hf_tokenizer)) 
    
    before_batch_tfm = HF_TokenClassBeforeBatchTransform(hf_arch, hf_config, hf_tokenizer, hf_model,
                                                         max_length=seq_sz,
                                                         padding='max_length',
                                                         is_split_into_words=True, 
                                                         tok_kwargs={ 'return_special_tokens_mask': True })

    blocks = (
        HF_TextBlock(before_batch_tfm=before_batch_tfm, input_return_type=HF_TokenClassInput), 
        HF_TokenCategoryBlock(vocab=labels)
    )

    dblock = DataBlock(blocks=blocks, 
                       get_x=ColReader('tokens'),
                       get_y= lambda inp: [ 
                           (label, len(hf_tokenizer.tokenize(str(entity)))) 
                           for entity, label in zip(inp.tokens, inp.labels) 
                       ],
                       splitter=RandomSplitter())
    
    dls = dblock.dataloaders(germ_eval_df, bs=bsz)

    model = HF_BaseModelWrapper(hf_model)
    learn = Learner(dls, 
                model,
                opt_func=partial(Adam),
                cbs=[HF_BaseModelCallback],
                splitter=hf_splitter).to_fp16()

    learn.create_opt()             # -> will create your layer groups based on your "splitter" function
    learn.freeze()
    
    b = dls.one_batch()
    
    try:
        print('*** TESTING DataLoaders ***')
        test_eq(len(b), 2)
        test_eq(len(b[0]['input_ids']), bsz)
        test_eq(b[0]['input_ids'].shape, torch.Size([bsz, seq_sz]))
        test_eq(len(b[1]), bsz)

        print('*** TESTING Training/Results ***')
        learn.fit_one_cycle(1, lr_max= 3e-5, moms=(0.8,0.7,0.8), 
                            cbs=[HF_TokenClassMetricsCallback(tok_metrics=['accuracy'])])

        test_results.append((hf_arch, type(hf_tokenizer).__name__, type(hf_model).__name__, 'PASSED', ''))
        learn.show_results(learner=learn, max_n=2, trunc_at=10)
        
    except Exception as err:
        test_results.append((hf_arch, type(hf_tokenizer).__name__, type(hf_model).__name__, 'FAILED', err))
        
    finally:
        # cleanup
        del learn; torch.cuda.empty_cache()
{% endraw %} {% raw %}
arch tokenizer model_name result error
0 albert AlbertTokenizerFast AlbertForTokenClassification PASSED
1 bert BertTokenizerFast BertForTokenClassification PASSED
2 camembert CamembertTokenizerFast CamembertForTokenClassification PASSED
3 distilbert DistilBertTokenizerFast DistilBertForTokenClassification PASSED
4 electra ElectraTokenizerFast ElectraForTokenClassification PASSED
5 flaubert FlaubertTokenizer FlaubertForTokenClassification PASSED
6 funnel FunnelTokenizerFast FunnelForTokenClassification PASSED
7 longformer LongformerTokenizerFast LongformerForTokenClassification PASSED
8 mpnet MPNetTokenizerFast MPNetForTokenClassification PASSED
9 mobilebert MobileBertTokenizerFast MobileBertForTokenClassification PASSED
10 roberta RobertaTokenizerFast RobertaForTokenClassification PASSED
11 squeezebert SqueezeBertTokenizerFast SqueezeBertForTokenClassification PASSED
12 xlm XLMTokenizer XLMForTokenClassification PASSED
13 xlm_roberta XLMRobertaTokenizerFast XLMRobertaForTokenClassification PASSED
14 xlnet XLNetTokenizerFast XLNetForTokenClassification PASSED
{% endraw %}

Cleanup