Skip to content

Commit

Permalink
Add model specific output classes to PoolFormer model docs (huggingfa…
Browse files Browse the repository at this point in the history
…ce#15746)

* Added model specific output classes to poolformer docs

* Fixed Segformer typo in Poolformer docs
  • Loading branch information
tanaymeh authored and James Reed committed Mar 8, 2022
1 parent 32cc6c6 commit 43ef170
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/source/model_doc/poolformer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The abstract from the paper is the following:

*Transformers have shown great potential in computer vision tasks. A common belief is their attention-based token mixer module contributes most to their competence. However, recent works show the attention-based module in transformers can be replaced by spatial MLPs and the resulted models still perform quite well. Based on this observation, we hypothesize that the general architecture of the transformers, instead of the specific token mixer module, is more essential to the model's performance. To verify this, we deliberately replace the attention module in transformers with an embarrassingly simple spatial pooling operator to conduct only the most basic token mixing. Surprisingly, we observe that the derived model, termed as PoolFormer, achieves competitive performance on multiple computer vision tasks. For example, on ImageNet-1K, PoolFormer achieves 82.1% top-1 accuracy, surpassing well-tuned vision transformer/MLP-like baselines DeiT-B/ResMLP-B24 by 0.3%/1.1% accuracy with 35%/52% fewer parameters and 48%/60% fewer MACs. The effectiveness of PoolFormer verifies our hypothesis and urges us to initiate the concept of "MetaFormer", a general architecture abstracted from transformers without specifying the token mixer. Based on the extensive experiments, we argue that MetaFormer is the key player in achieving superior results for recent transformer and MLP-like models on vision tasks. This work calls for more future research dedicated to improving MetaFormer instead of focusing on the token mixer modules. Additionally, our proposed PoolFormer could serve as a starting baseline for future MetaFormer architecture design.*

The figure below illustrates the architecture of SegFormer. Taken from the [original paper](https://arxiv.org/abs/2111.11418).
The figure below illustrates the architecture of PoolFormer. Taken from the [original paper](https://arxiv.org/abs/2111.11418).

<img width="600" src="https://user-images.githubusercontent.com/15921929/142746124-1ab7635d-2536-4a0e-ad43-b4fe2c5a525d.png"/>

Expand All @@ -41,6 +41,12 @@ Tips:

This model was contributed by [heytanay](https://huggingface.co/heytanay). The original code can be found [here](https://github.com/sail-sg/poolformer).

## PoolFormer specific outputs

[[autodoc]] models.poolformer.modeling_poolformer.PoolFormerModelOutput

[[autodoc]] models.poolformer.modeling_poolformer.PoolFormerClassifierOutput

## PoolFormerConfig

[[autodoc]] PoolFormerConfig
Expand Down

0 comments on commit 43ef170

Please sign in to comment.