Default models for pipeline tasks

What are the default models used for the various pipeline tasks? I assume the “SummarizationPipeline” uses Bart-large-cnn or some variant of T5, but what about the other tasks?

|ConversationalPipeline|?|
|FeatureExtractionPipeline|?|
|FillMaskPipeline|?|
|QuestionAnsweringPipeline|?|
|SummarizationPipeline|BART or T5 (?)|
|TextClassificationPipeline|?|
|TextGenerationPipeline|?|
|TokenClassificationPipeline|?|
|TranslationPipeline|?|
|ZeroShotClassificationPipeline|?|
|Text2TextGenerationPipeline|?|

1 Like

You can find all the defaults here:

4 Likes

Thanks. @BramVanroy
Any idea on what basis these defaults were chosen for each task?

Hi Bram. Many thanks for pointing to the repo. I already learned yesterday about sentiment-analysis being an “alias” to the text-analysis pipeline. I am interested in the same question as the original poster was. Finding out what the default models for the various tasks I can use with the pipeline library. If you use CTRL-SPACE in VSCode to get autocompletion for the pipeline item, you get about 30 different options you can use with the pipeline. Things like “audio-classification”, “depht-estimation”, “image-to-text”, visual question.-answering and many more. I added screenshots about all the options I get from this. I tried to find them in the transformers/pipeline.py file but I missed. Where could I find the corresponding default models used for these tasks? Not truly urgent but I am building a GUI for handling pipeline tasks and I would like to download the correct models upfront for offline use. Many thanks for any hints.

1 Like

I feel like this is hard-coded…

Yes, exactly. There is no pipelines.py file anymore, the relevant code has been moved to __init__.py. The pre-configs are all stored in the SUPPORTED_TASKS variable, as already explained here:

2 Likes

Code snippet to get a dict of default models.

from transformers.pipelines import SUPPORTED_TASKS
def_models = {k: v["default"]["model"]["pt"][0] for k, v in SUPPORTED_TASKS.items() if "model" in v["default"].keys()}
print(def_models)
# {'audio-classification': 'superb/wav2vec2-base-superb-ks', 'automatic-speech-recognition': 'facebook/wav2vec2-base-960h', 'text-to-audio': 'suno/bark-small',
#  'feature-extraction': 'distilbert/distilbert-base-cased', 'text-classification': 'distilbert/distilbert-base-uncased-finetuned-sst-2-english',
#  'token-classification': 'dbmdz/bert-large-cased-finetuned-conll03-english', 'question-answering': 'distilbert/distilbert-base-cased-distilled-squad',
#  'table-question-answering': 'google/tapas-base-finetuned-wtq', 'visual-question-answering': 'dandelin/vilt-b32-finetuned-vqa',
#  'document-question-answering': 'impira/layoutlm-document-qa', 'fill-mask': 'distilbert/distilroberta-base', 'summarization': 'sshleifer/distilbart-cnn-12-6',
#  'text2text-generation': 'google-t5/t5-base', 'text-generation': 'openai-community/gpt2', 'zero-shot-classification': 'facebook/bart-large-mnli',
#  'zero-shot-image-classification': 'openai/clip-vit-base-patch32', 'zero-shot-audio-classification': 'laion/clap-htsat-fused',
#  'image-classification': 'google/vit-base-patch16-224', 'image-feature-extraction': 'google/vit-base-patch16-224',
#  'image-segmentation': 'facebook/detr-resnet-50-panoptic', 'image-to-text': 'ydshieh/vit-gpt2-coco-en',
#  'object-detection': 'facebook/detr-resnet-50', 'zero-shot-object-detection': 'google/owlvit-base-patch32',
#  'depth-estimation': 'Intel/dpt-large', 'video-classification': 'MCG-NJU/videomae-base-finetuned-kinetics', 'mask-generation': 'facebook/sam-vit-huge', 'image-to-image': 'caidas/swin2SR-classical-sr-x2-64'} 
2 Likes

Many thanks for your patience, sir. I missed that the other “aliases” could be in the same file you told me about when I asked about “sentiment-analysis”. Should have come to my mind by myself to check this. Thanks.

1 Like

Grate idea, thank you very much.

1 Like