Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Poolformer #137

Merged
merged 16 commits into from
Feb 28, 2022
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pip install flowvision==0.1.0
<li>Swin Transformer</li>
<li>CSwin Transformer</li>
<li>CrossFormer</li>
<li>PoolFormer</li>
<li>Mlp Mixer</li>
<li>ResMLP</li>
<li>gMLP</li>
Expand Down
10 changes: 10 additions & 0 deletions ci/check/run_speed_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/convnext.py convnext_tiny_224 16x3x224
python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/mlp_mixer.py mlp_mixer_b16_224 16x3x224x224 --no-show-memory --times $TIMES | check_relative_speed 1.01 | write_to_file_and_print
python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/cswin.py cswin_tiny_224 16x3x224x224 --no-show-memory --times $TIMES | check_relative_speed 1.01 | write_to_file_and_print
python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/crossformer.py crossformer_tiny_patch4_group7_224 16x3x224x224 --no-show-memory --times $TIMES | check_relative_speed 1.01 | write_to_file_and_print
python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/poolformer.py poolformer_s12 16x3x224x224 --no-show-memory --times $TIMES | check_relative_speed 1.01 | write_to_file_and_print
python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/poolformer.py poolformer_s24 16x3x224x224 --no-show-memory --times $TIMES | check_relative_speed 1.01 | write_to_file_and_print
python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/poolformer.py poolformer_s36 16x3x224x224 --no-show-memory --times $TIMES | check_relative_speed 1.01 | write_to_file_and_print
python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/poolformer.py poolformer_m36 16x3x224x224 --no-show-memory --times $TIMES | check_relative_speed 1.01 | write_to_file_and_print
python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/poolformer.py poolformer_m48 16x3x224x224 --no-show-memory --times $TIMES | check_relative_speed 1.01 | write_to_file_and_print
python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/res_mlp.py resmlp_12_224 16x3x224x224 --no-show-memory --times $TIMES | check_relative_speed 1.01 | write_to_file_and_print
python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/res_mlp.py resmlp_24_224 16x3x224x224 --no-show-memory --times $TIMES | check_relative_speed 1.01 | write_to_file_and_print
python3 $COMPARE_SCRIPT_PATH $MODELS_ROOT/pvt.py pvt_tiny 16x3x224x224 --no-show-memory --times $TIMES | check_relative_speed 1.01 | write_to_file_and_print
Expand Down Expand Up @@ -58,6 +63,11 @@ python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $M
python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $MODELS_ROOT/mlp_mixer.py mlp_mixer_b16_224 16x3x224x224 --no-show-memory --times $TIMES --ddp --disable-backward | check_relative_speed 0.99 | write_to_file_and_print
python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $MODELS_ROOT/cswin.py cswin_tiny_224 16x3x224x224 --no-show-memory --times $TIMES --ddp | check_relative_speed 0.99 | write_to_file_and_print
python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $MODELS_ROOT/crossformer.py crossformer_tiny_patch4_group7_224 16x3x224x224 --no-show-memory --times $TIMES --ddp | check_relative_speed 0.99 | write_to_file_and_print
python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $MODELS_ROOT/poolformer.py poolformer_s12 16x3x224x224 --no-show-memory --times $TIMES --ddp | check_relative_speed 0.99 | write_to_file_and_print
python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $MODELS_ROOT/poolformer.py poolformer_s24 16x3x224x224 --no-show-memory --times $TIMES --ddp | check_relative_speed 0.99 | write_to_file_and_print
python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $MODELS_ROOT/poolformer.py poolformer_s36 16x3x224x224 --no-show-memory --times $TIMES --ddp | check_relative_speed 0.99 | write_to_file_and_print
python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $MODELS_ROOT/poolformer.py poolformer_m36 16x3x224x224 --no-show-memory --times $TIMES --ddp | check_relative_speed 0.99 | write_to_file_and_print
python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $MODELS_ROOT/poolformer.py poolformer_m48 16x3x224x224 --no-show-memory --times $TIMES --ddp | check_relative_speed 0.99 | write_to_file_and_print
python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $MODELS_ROOT/res_mlp.py resmlp_12_224 16x3x224x224 --no-show-memory --times $TIMES --ddp | check_relative_speed 0.99 | write_to_file_and_print
python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $MODELS_ROOT/res_mlp.py resmlp_24_224 16x3x224x224 --no-show-memory --times $TIMES --ddp | check_relative_speed 0.99 | write_to_file_and_print
python3 -m oneflow.distributed.launch --nproc_per_node 2 $COMPARE_SCRIPT_PATH $MODELS_ROOT/pvt.py pvt_tiny 16x3x224x224 --no-show-memory --times $TIMES --ddp | check_relative_speed 0.99 | write_to_file_and_print
Expand Down
13 changes: 13 additions & 0 deletions docs/source/flowvision.models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ architectures for image classification:
- `Swin-Transformer`_
- `CSwin-Transformer`_
- `CrossFormer`_
- `PoolFormer`_
- `Mlp_Mixer`_
- `ResMLP`_
- `gMLP`_
Expand Down Expand Up @@ -60,6 +61,7 @@ architectures for image classification:
.. _Swin-Transformer: https://arxiv.org/abs/2103.14030
.. _CSwin-Transformer: https://arxiv.org/abs/2107.00652
.. _CrossFormer: https://arxiv.org/abs/2108.00154
.. _PoolFormer: https://arxiv.org/abs/2111.11418
.. _Mlp_Mixer: https://arxiv.org/abs/2105.01601
.. _ResMLP: https://arxiv.org/abs/2105.03404
.. _gMLP: https://arxiv.org/abs/2105.08050
Expand Down Expand Up @@ -315,6 +317,17 @@ CrossFormer
crossformer_large_patch4_group7_224,


PoolFormer
-----------
.. automodule:: flowvision.models
:members:
poolformer_s12,
poolformer_s24,
poolformer_s36,
poolformer_m36,
poolformer_m48,


Mlp-Mixer
---------
.. automodule:: flowvision.models
Expand Down
1 change: 1 addition & 0 deletions flowvision/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from .efficientnet import *
from .vision_transformer import *
from .convnext import *
from .poolformer import *

from . import neural_style_transfer
from . import detection
Expand Down