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

Increased memory usage vs. torchvision equivalent #42

Closed
nlml opened this issue Jan 18, 2021 · 3 comments
Closed

Increased memory usage vs. torchvision equivalent #42

nlml opened this issue Jan 18, 2021 · 3 comments

Comments

@nlml
Copy link

nlml commented Jan 18, 2021

Hello,

First of all: fantastic paper and contribution -- and the pypi package is the cherry on top :D

I decided to try switching one of my model trainings to use antialiased_cnns.resnet34 as a drop-in replacement for torchvision.models.resnet34. It seems however that the memory needs are almost 1.5x higher with the anti-aliased CNN. This is based on the fact that with the torchvision version, my model trains with a batch size of 16 per GPU (it's a sequence model, so the actual number of images going through the CNN per batch is actually much higher). With the anti-aliased CNN, I get CUDA out of memory errors for any batch size above 11.

Were you aware of this? I'm not really expecting you to post a fix, just wondering if it makes sense to you and if you were already aware of it.

Thanks again!

@richzhang
Copy link
Contributor

Thanks for the message! Yes, it takes more memory. I implemented a gradient accumulation flag, which approximates training with larger batch sizes (for example, accumulate the gradient over 2 batches of size N/2 and then update)

@nlml
Copy link
Author

nlml commented Jan 20, 2021

Thanks for the response! Out of curiosity, did you think about whether the memory footprint can be reduced, maybe by using some in-place operations, or is that not possible here?

@nlml nlml closed this as completed Jan 20, 2021
@richzhang
Copy link
Contributor

I think if it were forward-pass only, the operation could be made in-place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants