Transformers库中的pipeline模块支持的NLP任务
Transformers库中的pipeline模块支持以下的NLP任务:
- Text Classification(文本分类):文本分类任务,比如情感分析, toxicity检测等。
- Token Classification(标记分类): 序列标记任务,比如命名实体识别, 部分性提取等。
- Question Answering(问答):question answering任务,可以回答给定问题的答案。
- Fill Mask(填充掩码):使用模型预测被掩码的词语。
- Summarization(文本摘要): 文本摘要任务,可以自动生成文本摘要。
- Translation(翻译):机器翻译任务,可以翻译不同语言。
- Feature Extraction(特征提取):从文本中提取语义特征向量。
- Conversational(对话):用于任务型对话,可以问答。
- Text Generation(文本生成):自动生成文本。
- Sentiment Analysis(情感分析):情感分析,判断文本情感极性。
- Named Entity Recognition (NER)(命名实体识别):命名实体识别,找出文本中实体。
- 等等
使用pipeline可以便捷地完成这些NLP 下游任务,无需训练模型,通过指定任务类型、模型名称即可使用。它封装了模型和tokenization,可以快速上手NLP项目。
2023年9月,产品 pipeline 的代码,全列表如下,
"audio-classification"
: will return a [AudioClassificationPipeline
]."automatic-speech-recognition"
: will return a [AutomaticSpeechRecognitionPipeline
]."conversational"
: will return a [ConversationalPipeline
]."depth-estimation"
: will return a [DepthEstimationPipeline
]."document-question-answering"
: will return a [DocumentQuestionAnsweringPipeline
]."feature-extraction"
: will return a [FeatureExtractionPipeline
]."fill-mask"
: will return a [FillMaskPipeline
]:."image-classification"
: will return a [ImageClassificationPipeline
]."image-segmentation"
: will return a [ImageSegmentationPipeline
]."image-to-text"
: will return a [ImageToTextPipeline
]."mask-generation"
: will return a [MaskGenerationPipeline
]."object-detection"
: will return a [ObjectDetectionPipeline
]."question-answering"
: will return a [QuestionAnsweringPipeline
]."summarization"
: will return a [SummarizationPipeline
]."table-question-answering"
: will return a [TableQuestionAnsweringPipeline
]."text2text-generation"
: will return a [Text2TextGenerationPipeline
]."text-classification"
(alias"sentiment-analysis"
available): will return a
[TextClassificationPipeline
]."text-generation"
: will return a [TextGenerationPipeline
]:."token-classification"
(alias"ner"
available): will return a [TokenClassificationPipeline
]."translation"
: will return a [TranslationPipeline
]."translation_xx_to_yy"
: will return a [TranslationPipeline
]."video-classification"
: will return a [VideoClassificationPipeline
]."visual-question-answering"
: will return a [VisualQuestionAnsweringPipeline
]."zero-shot-classification"
: will return a [ZeroShotClassificationPipeline
]."zero-shot-image-classification"
: will return a [ZeroShotImageClassificationPipeline
]."zero-shot-audio-classification"
: will return a [ZeroShotAudioClassificationPipeline
]."zero-shot-object-detection"
: will return a [ZeroShotObjectDetectionPipeline
].
完结!