-
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
MaxVit model #6342
Merged
Merged
MaxVit model #6342
Changes from 4 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
f15fd92
Added maxvit architecture and tests
TeodorPoncu c5b2839
rebased + addresed comments
TeodorPoncu 5e8a222
Revert "rebased + addresed comments"
TeodorPoncu aa95139
Re-added model changes after revert
TeodorPoncu 1fddecc
aligned with partial original implementation
TeodorPoncu b7f0e97
removed submitit script fixed lint
TeodorPoncu 872f40f
mypy fix for too many arguments
TeodorPoncu f561edf
updated old tests
TeodorPoncu 314b82a
removed per batch lr scheduler and seed setting
TeodorPoncu a4863e9
removed ontap
TeodorPoncu c4406e4
Merge branch 'main' into BATERIES]-add-max-vit
TeodorPoncu 2111680
added docs, validated weights
TeodorPoncu cc51c2b
fixed test expect, moved shape assertions in the begging for torch.fx…
TeodorPoncu d2dfe71
mypy fix
TeodorPoncu 328f9b6
lint fix
TeodorPoncu b334b7f
added legacy interface
TeodorPoncu ebb8c16
added weight link
TeodorPoncu e281371
Merge branch 'main' into BATERIES]-add-max-vit
TeodorPoncu 20422bc
updated docs
TeodorPoncu 9ad86fe
Merge branch 'BATERIES]-add-max-vit' of https://github.com/pytorch/vi…
TeodorPoncu 775990c
Merge branch 'main' into BATERIES]-add-max-vit
TeodorPoncu a24e549
Update references/classification/train.py
TeodorPoncu bb42548
Update torchvision/models/maxvit.py
TeodorPoncu ed21d3d
adressed comments
TeodorPoncu 09e4ced
Merge branch 'main' into BATERIES]-add-max-vit
TeodorPoncu 521d6d5
update ra_maginuted and augmix_severity default values
TeodorPoncu 79cb004
Merge branch 'BATERIES]-add-max-vit' of https://github.com/pytorch/vi…
TeodorPoncu 97cbcd8
adressed some comments
TeodorPoncu 9fc6a5b
Merge branch 'BATERIES]-add-max-vit' of https://github.com/pytorch/vi…
TeodorPoncu 6b00ca8
remove input_channels parameter
TeodorPoncu 45d3966
Merge branch 'main' into BATERIES]-add-max-vit
TeodorPoncu 2aca920
Merge branch 'main' into BATERIES]-add-max-vit
TeodorPoncu cab35c1
Merge branch 'main' into BATERIES]-add-max-vit
TeodorPoncu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import unittest | ||
|
||
import pytest | ||
import torch | ||
|
||
from torchvision.models.maxvit import SwapAxes, WindowDepartition, WindowPartition | ||
|
||
|
||
class MaxvitTester(unittest.TestCase): | ||
def test_maxvit_window_partition(self): | ||
input_shape = (1, 3, 224, 224) | ||
partition_size = 7 | ||
|
||
x = torch.randn(input_shape) | ||
|
||
partition = WindowPartition(partition_size=7) | ||
departition = WindowDepartition(partition_size=partition_size, n_partitions=(input_shape[3] // partition_size)) | ||
|
||
assert torch.allclose(x, departition(partition(x))) | ||
|
||
def test_maxvit_grid_partition(self): | ||
input_shape = (1, 3, 224, 224) | ||
partition_size = 7 | ||
|
||
x = torch.randn(input_shape) | ||
partition = torch.nn.Sequential( | ||
WindowPartition(partition_size=(input_shape[3] // partition_size)), | ||
SwapAxes(-2, -3), | ||
) | ||
departition = torch.nn.Sequential( | ||
SwapAxes(-2, -3), | ||
WindowDepartition(partition_size=(input_shape[3] // partition_size), n_partitions=partition_size), | ||
) | ||
|
||
assert torch.allclose(x, departition(partition(x))) | ||
|
||
|
||
if __name__ == "__main__": | ||
pytest.main([__file__]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I understand that here you are testing specific layers from MaxViT. This is not something we did previously, so perhaps it does need to be on a separate file.
@YosuaMichael any thoughts here?
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.
Sorry for a pretty late response!
Currently I dont have any opinion how we should test specific layer of the model and I think this is okay. (Need more time to think and discuss whether we should do more of this kind of test or not)