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

[diffusion_labs] Move attention and res blocks under modules #490

Closed
wants to merge 5 commits into from

Conversation

ebsmothers
Copy link
Contributor

@ebsmothers ebsmothers commented Oct 13, 2023

This was referenced Oct 13, 2023
ebsmothers added a commit that referenced this pull request Oct 13, 2023
ghstack-source-id: f349ffbd25dc494c85a24fad5a600ea78859a079
Pull Request resolved: #490
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 13, 2023
@ebsmothers
Copy link
Contributor Author

@ebsmothers has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2023

Codecov Report

All modified lines are covered by tests ✅

❗ No coverage uploaded for pull request base (gh/ebsmothers/21/base@b948406). Click here to learn what that means.

Additional details and impacted files
@@                   Coverage Diff                    @@
##             gh/ebsmothers/21/base     #490   +/-   ##
========================================================
  Coverage                         ?   74.12%           
========================================================
  Files                            ?      207           
  Lines                            ?    14259           
  Branches                         ?        0           
========================================================
  Hits                             ?    10569           
  Misses                           ?     3690           
  Partials                         ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ebsmothers added a commit that referenced this pull request Oct 13, 2023
ghstack-source-id: 2a08dd2d97ac9ca734a8d4af55361ff1e825080f
Pull Request resolved: #490
@ebsmothers
Copy link
Contributor Author

@ebsmothers has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@pbontrager pbontrager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't personally agree with this diff. If these modules can live as generic layers, then they should be under torchmultimodal/modules/layers while if they're just specific to ADM then they should be under adm_unet. I think we should keep the diffusion folders as focused on diffusion as possible and try to keep out other things.

@ebsmothers
Copy link
Contributor Author

@pbontrager I guess there are three possible places for these components: diffusion_labs/models/adm_unet/..., diffusion_labs/modules/..., and torchmultimodal/modules/.... I agree that the first location should be for components specific to ADM UNet. The second should be for more generic diffusion components (i.e. not tied to ADM specifically), while components in the third location should have use for other non-diffusion cases.

Based on those conditions I think it should be either option (1) or (2), since I'm not aware of any models outside of diffusion_labs that would use these components. @abhinavarora mentioned that there are other diffusion models that can benefit from these components which is why I opened this PR. But if that's not the case, we can just close this and leave them where they are. Let me know what both of you think here.

@pbontrager
Copy link
Contributor

@pbontrager I guess there are three possible places for these components: diffusion_labs/models/adm_unet/..., diffusion_labs/modules/..., and torchmultimodal/modules/.... I agree that the first location should be for components specific to ADM UNet. The second should be for more generic diffusion components (i.e. not tied to ADM specifically), while components in the third location should have use for other non-diffusion cases.

Based on those conditions I think it should be either option (1) or (2), since I'm not aware of any models outside of diffusion_labs that would use these components. @abhinavarora mentioned that there are other diffusion models that can benefit from these components which is why I opened this PR. But if that's not the case, we can just close this and leave them where they are. Let me know what both of you think here.

I believe they should stay with adm_unet until they start being reused as they may require modifications at that time. At that time I think they should be moved to option (3) because, while the architecture is being used for diffusion training, neural networks are still pretty generic for all types of training. I'm open to discussing this further though.

@abhinavarora
Copy link
Contributor

My understanding is that these components are specific implementations of general concepts that have been popularized by prominent diffusion researchers (OpenAI, Stability, etc). I don't see them being used in any other models outside of those that build their code on top of OpenAI and StabilityAI repos. For example, this implementation of resnet blocks is quite different from the generic ones found in TorchVision.

Hence in my opinion, only option 1) and 2) make sense. To me option 2) makes more sense because components like ADMResBlock are used by all other models (VAE and LDM UNet). I am okay with 1) as well if you want to unblock the PT Conf works and punt this discussion to later.

ebsmothers added a commit that referenced this pull request Oct 16, 2023
ghstack-source-id: c6516a8e206a977bdf635d1febd466f7d6c08af1
Pull Request resolved: #490
ebsmothers added a commit that referenced this pull request Oct 16, 2023
ghstack-source-id: b9ab08988a1272c658b37b4dcf1cddf48cc20270
Pull Request resolved: #490
@ebsmothers
Copy link
Contributor Author

@ebsmothers has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

ebsmothers added a commit that referenced this pull request Oct 16, 2023
ghstack-source-id: f3a215b00331a35b0c5d05d26288feb5b37232ec
Pull Request resolved: #490
@ebsmothers
Copy link
Contributor Author

@ebsmothers has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@ebsmothers
Copy link
Contributor Author

Closing this since we are not planning to land these changes right now

@ebsmothers ebsmothers closed this Oct 17, 2023
@facebook-github-bot facebook-github-bot deleted the gh/ebsmothers/21/head branch November 16, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants