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

Create a base StreamingConstructor class #7

Open
stephandooper opened this issue Nov 27, 2023 · 0 comments
Open

Create a base StreamingConstructor class #7

stephandooper opened this issue Nov 27, 2023 · 0 comments

Comments

@stephandooper
Copy link
Collaborator

After adding convnext as a use-case, the current workflow of adding new modules is not elegant.

Here are the current pain points:

  • scnn only deals with batchnormalization and not any other normalization layers. What is also difficult is that Layernormalization cannot be handled in the same way as BN: setting sthe weights to 1 and bias to 0 will lead to a normalization of exactly 0, which breaks tile statistics calculations.
  • Layer scale is a thing in convnext, so again the tile calculations will break when they are not set to 1.
  • Linear layers can be used, if it's modelled as a 1x1 convolution. This works but it might be good to set a warning.
  • scnn only handles relu activations, which conveniently break at 0 and then proceed linearly, but newer activation functions might break tile calculations.

Proposed solution:

  • It is easier to set most of the problematic to a nn.Identity() and restore them later. Since most layers will not contribute to Lost tile calculations, this will simplify a lot:
    • For normalization layers, this will be easier, since no weights/biases need to be handled.
    • Random activation functions will not influence tile statistics calculations

In essence, during streaming initialization, only conv, local max, and local avg pooling functions will be left. This way, the tile calculations are as basic as they can be, and then the modules can be reconstructed.

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

1 participant