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

Nonseq #245

Draft
wants to merge 365 commits into
base: develop
Choose a base branch
from
Draft

Nonseq #245

wants to merge 365 commits into from

Conversation

ssinhaleite
Copy link
Member

@ssinhaleite ssinhaleite commented Jul 10, 2024

Checklist before requesting a review

Unit tests

  • Tests for the changes have been added (for bug fixes/features)
  • All tests are passing.

Documentation

  • Add tutorial(s) about how to deploy a non-sequential model
  • Fix any inconsistencies with existing documentation (e.g. changed function parameters, deprecated methods, etc.)
  • Add graph that shows developers how different classes interact
  • Make sure in-code documentation is complete (e.g. missing or incomplete docstrings)
  • CHANGELOG.md: Make sure to list any breaking changes

Review

  • I have performed a self-review of my code
  • Address open suggestions from the review (typos etc)
  • Take care of all TODOs inside the code
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    New feature, including extensive changes in code, documentation and unit tests.

  • What is the current behavior? (You can also link to an open issue here)
    So far, only sequential models can be deployed on DynapCNN chips.

  • What is the new behavior (if this is a feature change)?
    Allow non-sequential SNNs (e.g. residuals, recurrent, ...) to be deployed on DynapCNN chips.

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
    Potentially. Ideally for sequential SNNs there are no (or minimal) breaking changes, but this has to be assessed when reviewing this PR.

  • Other information:
    The changes are quite extensive, so reviewing this will take some time.

Willian-Girao and others added 10 commits May 28, 2024 16:10
Updated function headers and type-hints.
- DynapcnnNetwork._to_device() calling DynapcnnLayer.to() (no need to call .to() from each individual layer within).
- _to_device() is calling .to() on the new Merge() layers created for the forward call to.
- forward method works like a charm: if DynapcnnNetwork(discretize=True) the loss does not change during training.
- Extraction of config. dict of a DynapcnnLayer removed from class and moved back to ConfigBuilder class.
- Updated function headers/type hints/in-line documentation.
- Refactored 'ConfigBuilder.get_dynapcnn_layer_config_dict' to create 'destinations' dict entry to handle setting of the destinations config. object.
- Ranamed '_forward_map' into 'layers_mapper' in DynapcnnNetwork to better fit its role in the network construction/chip deployment.
Added verification to '.get_pool_kernel_size()' to make sure node passed as argument is one of the layers in the instance.
Updated call from '.forward_map' to '.layers_mapper'.
- DynapcnnLayer accessible from dynapcnn/__init__.
- Removed wild prints.
self.dvs_input = dvs_input
self.input_shape = input_shape

assert len(self.input_shape) == 3, "infer_input_shape did not return 3-tuple"
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Should not be assert, but if/else and possible ValueError
  2. Where did the infer_input_shape part go? Is that not possible anymore?

sinabs/backend/dynapcnn/dynapcnn_layer.py Show resolved Hide resolved
…to gather network-level info to generate the arguments for a DynapcnnLayer instance
…ame a 'handler' class whose only job is to pre-processes network-level data to generate args for a DynapcnnLayer instance
…e DynapcnnLayers, but instead holding the DynapcnnLayerHandlers used to instantiate each layer
…from the instance if deployment is successfull
Copy link
Contributor

@bauerfe bauerfe left a comment

Choose a reason for hiding this comment

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

This is not a full review, but I will finish it for now so the suggestions become visible

sinabs/backend/dynapcnn/dynapcnn_layer_v2.py Outdated Show resolved Hide resolved
sinabs/backend/dynapcnn/dynapcnn_layer_v2.py Outdated Show resolved Hide resolved
sinabs/backend/dynapcnn/dynapcnn_layer_v2.py Outdated Show resolved Hide resolved
sinabs/backend/dynapcnn/dynapcnn_layer_v2.py Outdated Show resolved Hide resolved
sinabs/backend/dynapcnn/dynapcnn_layer_v2.py Outdated Show resolved Hide resolved
sinabs/backend/dynapcnn/chips/dynapcnn.py Outdated Show resolved Hide resolved
sinabs/backend/dynapcnn/chips/dynapcnn.py Outdated Show resolved Hide resolved
sinabs/backend/dynapcnn/chips/dynapcnn.py Outdated Show resolved Hide resolved
sinabs/backend/dynapcnn/chips/speck2e.py Outdated Show resolved Hide resolved
sinabs/backend/dynapcnn/exceptions.py Outdated Show resolved Hide resolved
@bauerfe
Copy link
Contributor

bauerfe commented Nov 12, 2024

All unit tests passing on my machine 🍾

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

Attention: Patch coverage is 87.16012% with 170 lines in your changes missing coverage. Please review.

Project coverage is 88.83%. Comparing base (276eda3) to head (347e225).
Report is 13 commits behind head on develop.

Files with missing lines Patch % Lines
sinabs/backend/dynapcnn/dynapcnn_network.py 71.92% 48 Missing ⚠️
sinabs/backend/dynapcnn/sinabs_edges_handler.py 90.03% 26 Missing ⚠️
sinabs/backend/dynapcnn/dynapcnnnetwork_module.py 85.27% 19 Missing ⚠️
sinabs/backend/dynapcnn/nir_graph_extractor.py 93.51% 17 Missing ⚠️
sinabs/backend/dynapcnn/utils.py 86.02% 13 Missing ⚠️
sinabs/backend/dynapcnn/dynapcnn_layer.py 87.01% 10 Missing ⚠️
sinabs/backend/dynapcnn/exceptions.py 82.69% 9 Missing ⚠️
sinabs/utils.py 84.21% 6 Missing ⚠️
sinabs/backend/dynapcnn/dynapcnn_layer_utils.py 94.94% 5 Missing ⚠️
sinabs/from_torch.py 0.00% 5 Missing ⚠️
... and 4 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #245      +/-   ##
===========================================
- Coverage    90.91%   88.83%   -2.08%     
===========================================
  Files           52       58       +6     
  Lines         2718     3664     +946     
===========================================
+ Hits          2471     3255     +784     
- Misses         247      409     +162     

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

@bauerfe
Copy link
Contributor

bauerfe commented Nov 13, 2024

All checks passing on the CI now (with warnings from codecov - we should probably add more unit tests eventually).

@bauerfe
Copy link
Contributor

bauerfe commented Nov 13, 2024

I have extended the to-do list in the original post to be more specific and complete. It should now mention everything that still needs to be addressed. Please feel free to add and tick off items when appropriate.

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

Successfully merging this pull request may close these issues.

3 participants