2020-09-02 23:41:58 +00:00
|
|
|
# -------------------------------------------------------------------------
|
|
|
|
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
# Licensed under the MIT License. See License.txt in the project root for
|
|
|
|
|
# license information.
|
|
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
|
|
2020-09-08 22:06:04 +00:00
|
|
|
# Maps model class name to a tuple of model class
|
2020-09-11 07:47:37 +00:00
|
|
|
MODEL_CLASSES = [
|
2022-02-03 03:11:31 +00:00
|
|
|
'AutoModel', 'AutoModelWithLMHead', 'AutoModelForSequenceClassification', 'AutoModelForQuestionAnswering',
|
|
|
|
|
'AutoModelForCausalLM',
|
2020-11-06 19:54:19 +00:00
|
|
|
]
|
|
|
|
|
|
2020-09-02 23:41:58 +00:00
|
|
|
# List of pretrained models: https://huggingface.co/transformers/pretrained_models.html
|
2020-09-08 22:06:04 +00:00
|
|
|
# Pretrained model name to a tuple of input names, opset_version, use_external_data_format, optimization model type
|
2020-09-02 23:41:58 +00:00
|
|
|
MODELS = {
|
2020-09-10 22:42:15 +00:00
|
|
|
# BERT
|
2021-03-17 22:33:57 +00:00
|
|
|
"bert-base-uncased": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
"bert-large-uncased": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
"bert-base-cased": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-large-cased": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-base-multilingual-uncased": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-base-multilingual-cased": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-base-chinese": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-base-german-cased": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-large-uncased-whole-word-masking": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-large-cased-whole-word-masking": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-large-uncased-whole-word-masking-finetuned-squad": (["input_ids", "attention_mask",
|
|
|
|
|
# "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-large-cased-whole-word-masking-finetuned-squad": (["input_ids", "attention_mask",
|
|
|
|
|
# "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-base-cased-finetuned-mrpc": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-base-german-dbmdz-cased": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# "bert-base-german-dbmdz-uncased": (["input_ids", "attention_mask", "token_type_ids"], 12, False, "bert"),
|
|
|
|
|
# todo: more models to add
|
2021-02-24 20:52:35 +00:00
|
|
|
# GPT (no past state)
|
|
|
|
|
"openai-gpt": (["input_ids"], 11, False, "gpt2"),
|
|
|
|
|
# GPT-2 (no past state, use benchmark_gpt2.py for past_key_values)
|
|
|
|
|
"gpt2": (["input_ids"], 11, False, "gpt2"),
|
2020-09-02 23:41:58 +00:00
|
|
|
"gpt2-medium": (["input_ids"], 11, False, "gpt2"),
|
2021-02-24 20:52:35 +00:00
|
|
|
"gpt2-large": (["input_ids"], 11, True, "gpt2"),
|
2020-09-02 23:41:58 +00:00
|
|
|
"gpt2-xl": (["input_ids"], 11, True, "gpt2"),
|
2021-02-24 20:52:35 +00:00
|
|
|
"distilgpt2": (["input_ids"], 11, False, "gpt2"),
|
2021-07-14 23:00:17 +00:00
|
|
|
# Transformer-XL (Models uses Einsum, which need opset version 12 or later.)
|
|
|
|
|
"transfo-xl-wt103": (["input_ids", "mems"], 12, False, "bert"),
|
2020-09-10 22:42:15 +00:00
|
|
|
# XLNet
|
2021-02-24 20:52:35 +00:00
|
|
|
"xlnet-base-cased": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
"xlnet-large-cased": (["input_ids"], 12, False, "bert"),
|
2020-09-10 22:42:15 +00:00
|
|
|
# XLM
|
2020-09-02 23:41:58 +00:00
|
|
|
"xlm-mlm-en-2048": (["input_ids"], 11, True, "bert"),
|
|
|
|
|
"xlm-mlm-ende-1024": (["input_ids"], 11, False, "bert"),
|
|
|
|
|
"xlm-mlm-enfr-1024": (["input_ids"], 11, False, "bert"),
|
2020-09-10 22:42:15 +00:00
|
|
|
# RoBERTa
|
2021-03-17 22:33:57 +00:00
|
|
|
"roberta-base": (["input_ids", "attention_mask"], 12, False, "bert"),
|
|
|
|
|
"roberta-large": (["input_ids", "attention_mask"], 12, False, "bert"),
|
|
|
|
|
"roberta-large-mnli": (["input_ids", "attention_mask"], 12, False, "bert"),
|
2021-02-24 20:52:35 +00:00
|
|
|
"deepset/roberta-base-squad2": (["input_ids", "attention_mask"], 11, False, "bert"),
|
2021-03-17 22:33:57 +00:00
|
|
|
"distilroberta-base": (["input_ids", "attention_mask"], 12, False, "bert"),
|
2021-02-24 20:52:35 +00:00
|
|
|
|
2020-09-10 22:42:15 +00:00
|
|
|
# DistilBERT
|
2020-09-02 23:41:58 +00:00
|
|
|
"distilbert-base-uncased": (["input_ids", "attention_mask"], 11, False, "bert"),
|
2020-09-08 22:06:04 +00:00
|
|
|
"distilbert-base-uncased-distilled-squad": (["input_ids", "attention_mask"], 11, False, "bert"),
|
2020-09-10 22:42:15 +00:00
|
|
|
# CTRL
|
2020-09-02 23:41:58 +00:00
|
|
|
"ctrl": (["input_ids"], 11, True, "bert"),
|
2020-09-10 22:42:15 +00:00
|
|
|
# CamemBERT
|
2020-09-02 23:41:58 +00:00
|
|
|
"camembert-base": (["input_ids"], 11, False, "bert"),
|
2020-09-10 22:42:15 +00:00
|
|
|
# ALBERT
|
2020-09-02 23:41:58 +00:00
|
|
|
"albert-base-v1": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
"albert-large-v1": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
"albert-xlarge-v1": (["input_ids"], 12, True, "bert"),
|
2020-11-06 19:54:19 +00:00
|
|
|
#"albert-xxlarge-v1": (["input_ids"], 12, True, "bert"),
|
2020-09-02 23:41:58 +00:00
|
|
|
"albert-base-v2": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
"albert-large-v2": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
"albert-xlarge-v2": (["input_ids"], 12, True, "bert"),
|
2020-11-06 19:54:19 +00:00
|
|
|
#"albert-xxlarge-v2": (["input_ids"], 12, True, "bert"),
|
2021-02-24 20:52:35 +00:00
|
|
|
# T5 (use benchmark_t5.py instead)
|
2021-03-17 22:33:57 +00:00
|
|
|
# "t5-small": (["input_ids", "decoder_input_ids"], 12, False, "bert"),
|
|
|
|
|
# "t5-base": (["input_ids", "decoder_input_ids"], 12, False, "bert"),
|
|
|
|
|
# "t5-large": (["input_ids", "decoder_input_ids"], 12, True, "bert"),
|
|
|
|
|
# "t5-3b": (["input_ids", "decoder_input_ids"], 12, True, "bert"),
|
|
|
|
|
# "t5-11b": (["input_ids", "decoder_input_ids"], 12, True, "bert"),
|
2021-02-24 20:52:35 +00:00
|
|
|
#"valhalla/t5-small-qa-qg-hl": (["input_ids"], 12, True, "bert"),
|
2020-09-10 22:42:15 +00:00
|
|
|
# XLM-RoBERTa
|
2020-09-02 23:41:58 +00:00
|
|
|
"xlm-roberta-base": (["input_ids"], 11, False, "bert"),
|
|
|
|
|
"xlm-roberta-large": (["input_ids"], 11, True, "bert"),
|
2020-09-10 22:42:15 +00:00
|
|
|
# FlauBERT
|
2020-09-02 23:41:58 +00:00
|
|
|
"flaubert/flaubert_small_cased": (["input_ids"], 11, False, "bert"),
|
2021-02-24 20:52:35 +00:00
|
|
|
#"flaubert/flaubert_base_uncased": (["input_ids"], 11, False, "bert"),
|
2020-09-02 23:41:58 +00:00
|
|
|
"flaubert/flaubert_base_cased": (["input_ids"], 11, False, "bert"),
|
2021-02-24 20:52:35 +00:00
|
|
|
#"flaubert/flaubert_large_cased": (["input_ids"], 11, False, "bert"),
|
2020-09-10 22:42:15 +00:00
|
|
|
# Bart
|
2021-08-25 01:13:46 +00:00
|
|
|
"facebook/bart-large": (["input_ids", "attention_mask"], 11, False, "bart"),
|
|
|
|
|
"facebook/bart-base": (["input_ids", "attention_mask"], 11, False, "bart"),
|
|
|
|
|
"facebook/bart-large-mnli": (["input_ids", "attention_mask"], 11, False, "bart"),
|
|
|
|
|
"facebook/bart-large-cnn": (["input_ids", "attention_mask"], 11, False, "bart"),
|
2021-02-24 20:52:35 +00:00
|
|
|
|
2020-09-10 22:42:15 +00:00
|
|
|
# DialoGPT
|
2020-09-02 23:41:58 +00:00
|
|
|
"microsoft/DialoGPT-small": (["input_ids"], 11, False, "gpt2"),
|
|
|
|
|
"microsoft/DialoGPT-medium": (["input_ids"], 11, False, "gpt2"),
|
2021-02-24 20:52:35 +00:00
|
|
|
#"microsoft/DialoGPT-large": (["input_ids"], 11, True, "gpt2"),
|
2020-09-10 22:42:15 +00:00
|
|
|
# Reformer
|
2020-09-02 23:41:58 +00:00
|
|
|
#"google/reformer-enwik8": (["input_ids"], 11, False, "bert"),
|
|
|
|
|
#"google/reformer-crime-and-punishment": (["input_ids"], 11, False, "bert"),
|
2020-09-10 22:42:15 +00:00
|
|
|
# MarianMT
|
2020-09-02 23:41:58 +00:00
|
|
|
#"Helsinki-NLP/opus-mt-ROMANCE-en": (["input_ids"], 12, False, "bert"),
|
2021-02-24 20:52:35 +00:00
|
|
|
# Longformer (use benchmark_longformer.py instead)
|
2020-09-02 23:41:58 +00:00
|
|
|
#"allenai/longformer-base-4096": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
#"allenai/longformer-large-4096": (["input_ids"], 12, False, "bert"),
|
2021-02-26 21:58:41 +00:00
|
|
|
# MBart
|
|
|
|
|
"facebook/mbart-large-cc25": (["input_ids"], 11, True, "bert"),
|
|
|
|
|
"facebook/mbart-large-en-ro": (["input_ids"], 11, True, "bert"),
|
2021-03-17 22:33:57 +00:00
|
|
|
# "Helsinki-NLP/opus-mt-ROMANCE-en": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
# # Longformer
|
|
|
|
|
# "allenai/longformer-base-4096": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
# "allenai/longformer-large-4096": (["input_ids"], 12, True, "bert"),
|
|
|
|
|
# "funnel-transformer/small": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
# "funnel-transformer/small-base": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
# "funnel-transformer/medium": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
# "funnel-transformer/medium-base": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
# "funnel-transformer/intermediate": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
# "funnel-transformer/intermediate-base": (["input_ids"], 12, False, "bert"),
|
|
|
|
|
# "funnel-transformer/large": (["input_ids"], 12, True, "bert"),
|
|
|
|
|
# "funnel-transformer/large-base": (["input_ids"], 12, True, "bert"),
|
|
|
|
|
# "funnel-transformer/xlarge": (["input_ids"], 12, True, "bert"),
|
2021-07-14 23:00:17 +00:00
|
|
|
# "funnel-transformer/xlarge-base": (["input_ids"], 12, True, "bert"),
|
2021-02-26 21:58:41 +00:00
|
|
|
# Layoutlm
|
|
|
|
|
"microsoft/layoutlm-base-uncased": (["input_ids"], 11, False, "bert"),
|
|
|
|
|
"microsoft/layoutlm-large-uncased": (["input_ids"], 11, False, "bert"),
|
|
|
|
|
# Squeezebert
|
|
|
|
|
"squeezebert/squeezebert-uncased": (["input_ids"], 11, False, "bert"),
|
|
|
|
|
"squeezebert/squeezebert-mnli": (["input_ids"], 11, False, "bert"),
|
|
|
|
|
"squeezebert/squeezebert-mnli-headless": (["input_ids"], 11, False, "bert"),
|
2021-03-17 22:33:57 +00:00
|
|
|
"unc-nlp/lxmert-base-uncased": (["input_ids", "visual_feats", "visual_pos"], 11, False, "bert"),
|
|
|
|
|
# "google/pegasus-xsum": (["input_ids"], 11, False, "bert"),
|
|
|
|
|
# "google/pegasus-large": (["input_ids"], 11, False, "bert"),
|
2020-09-02 23:41:58 +00:00
|
|
|
}
|