docs/source/en/model_doc/funnel.md
This model was released on 2020-06-05 and added to Hugging Face Transformers on 2020-11-16.
The Funnel Transformer model was proposed in the paper Funnel-Transformer: Filtering out Sequential Redundancy for Efficient Language Processing. It is a bidirectional transformer model, like BERT, but with a pooling operation after each block of layers, a bit like in traditional convolutional neural networks (CNN) in computer vision.
The abstract from the paper is the following:
With the success of language pretraining, it is highly desirable to develop more efficient architectures of good scalability that can exploit the abundant unlabeled data at a lower cost. To improve the efficiency, we examine the much-overlooked redundancy in maintaining a full-length token-level presentation, especially for tasks that only require a single-vector presentation of the sequence. With this intuition, we propose Funnel-Transformer which gradually compresses the sequence of hidden states to a shorter one and hence reduces the computation cost. More importantly, by re-investing the saved FLOPs from length reduction in constructing a deeper or wider model, we further improve the model capacity. In addition, to perform token-level predictions as required by common pretraining objectives, Funnel-Transformer is able to recover a deep representation for each token from the reduced hidden sequence via a decoder. Empirically, with comparable or fewer FLOPs, Funnel-Transformer outperforms the standard Transformer on a wide variety of sequence-level prediction tasks, including text classification, language understanding, and reading comprehension.
This model was contributed by sgugger. The original code can be found here.
FunnelModel], [FunnelForPreTraining],
[FunnelForMaskedLM], [FunnelForTokenClassification] and
[FunnelForQuestionAnswering]. The second ones should be used for
[FunnelBaseModel], [FunnelForSequenceClassification] and
[FunnelForMultipleChoice].[[autodoc]] FunnelConfig
[[autodoc]] FunnelTokenizer - get_special_tokens_mask - save_vocabulary
[[autodoc]] FunnelTokenizerFast
[[autodoc]] models.funnel.modeling_funnel.FunnelForPreTrainingOutput
[[autodoc]] FunnelBaseModel - forward
[[autodoc]] FunnelModel - forward
[[autodoc]] FunnelForPreTraining - forward
[[autodoc]] FunnelForMaskedLM - forward
[[autodoc]] FunnelForSequenceClassification - forward
[[autodoc]] FunnelForMultipleChoice - forward
[[autodoc]] FunnelForTokenClassification - forward
[[autodoc]] FunnelForQuestionAnswering - forward