-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Adding more ConvNeXt variants + Speed optimizations #5253
Conversation
💊 CI failures summary and remediationsAs of commit d708d06 (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages: CodeQL / build (1/1)Step: "Build TorchVision" (full log | diagnosis details | 🔁 rerun)
|
Job | Step | Action |
---|---|---|
cmake_macos_cpu | curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh | |
sh conda.sh -b | ||
source $HOME/miniconda3/bin/activate | ||
conda install -yq conda-build cmake | ||
packaging/build_cmake.sh | ||
🔁 rerun |
This comment was automatically generated by Dr. CI (expand for details).
Please report bugs/suggestions to the (internal) Dr. CI Users group.
…x/vision into models/convnext_variants
…odels/convnext_variants
@s9xie @liuzhuang13 as discussed at #5197 (comment) here are some benchmarks on our side. This is the speed of TorchVision's current implementation 2bbb112 VS after applying this patch 290440b. I understand that your numbers were different but I acknowledge that my benchmarks focus only on a specific batch-size and hardware combination. The difference is big but I was hoping that we could fix the speed difference by optimizing the underlying kernel and avoid needing workarounds on TorchVision. Have you spoken with Core about it? Overall what are your thoughts? |
@datumbox Thanks! It seems after your patch our implementations are really similar, both using permuting and linear layers. If I understand your results correctly, yours is 15~20% faster than ours somehow. Any idea why? We will benchmark your current patched version against ours too. |
@liuzhuang13 I've assumed it's because I don't use a custom LayerNorm. I would love to know if you can confirm the above with your benchmarks. I've also notified the PyTorch performance team to see if that's something known and work on or something worth improving on the future (I've tagged you and Saining to the post for FYI). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @datumbox
Thanks for the review @NicolasHug. I'm going to move now the class to main TorchVision so that we can include it in the upcoming release. Edit: On second thought, I'll move the graduation to core area on a separate PR. |
Summary: * Refactor model builder * Add 3 more convnext variants. * Adding weights for convnext_small. * Fix minor bug. * Fix number of parameters for small model. * Adding weights for the base variant. * Adding weights for the large variant. * Simplify LayerNorm2d implementation. * Optimize speed of CNBlock. * Repackage weights. Reviewed By: kazhang Differential Revision: D33927490 fbshipit-source-id: 569d9f752b1c5d5ba6f9a8f9721b4f91fac6663d
Adding
convnext_small
,convnext_base
andconvnext_large
.Small
Base
Large
Also switch from channels first + Conv1x1 to channels last + Linear layers as it gets a 20% speed boost.