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
EHN Normalizing the last layer in all the models #520
EHN Normalizing the last layer in all the models #520
Conversation
Codecov Report
@@ Coverage Diff @@
## master #520 +/- ##
==========================================
+ Coverage 84.55% 84.72% +0.16%
==========================================
Files 63 63
Lines 4676 4741 +65
==========================================
+ Hits 3954 4017 +63
- Misses 722 724 +2 |
TODO: Add a new way to handle return features During the renaming, I had to remove the possibility of returning the output of the feature extractor when there was this option (on the SleepStagerEldele2021, SleepStagerBlanco2020, SleepStagerChambon2018, and DeepSleepNet models). However, this is required for some tutorials, so now they are broken. |
@brunaafl on it |
can you update the whats_new? |
Yes! I'll do that |
thx for the PR @brunaafl We discussed with @PierreGtch more in details how it should be done to support the transfer learning approach and be easy to use. We identified few cases in which we may act in slightly modified manner, so the PR will require some changes. We would be really happy if you find some time and try to address the changes:
@brunaafl would you have time to tackle that? if you have any doubts I would be happy to help! 😄 |
Hi! Yes, I can address those changes, although not today, just tomorrow and after. I'm happy to help! |
HI! I was wondering here, just to know if I really understood. So, you want the first layer that changes the shape of the tensor to one with one of the dimensions equal to n_outputs to be called My doubt is in the case where |
@brunaafl sorry for the confusion, there was some miscommunication at multiple levels. So everything after and including the classification layer (sometimes it is a self.add_module(
"conv_classifier",
nn.Conv2d(
self.n_filters_4,
self.n_outputs,
(self.final_conv_length, 1),
bias=True,
),
)
self.add_module("softmax", nn.LogSoftmax(dim=1))
self.add_module("squeeze", Expression(squeeze_final_output)) TO: self.add_module("final_layer", nn.Sequential())
self.final_layer.add_module(
"conv_classifier",
nn.Conv2d(
self.n_filters_4,
self.n_outputs,
(self.final_conv_length, 1),
bias=True,
),
)
self.final_layer.add_module("softmax", nn.LogSoftmax(dim=1))
self.final_layer.add_module("squeeze", Expression(squeeze_final_output)) If it's still not clear, please tell me |
Okay, it's clear now, thanks! |
Co-authored-by: PierreGtch <25532709+PierreGtch@users.noreply.github.com>
Co-authored-by: PierreGtch <25532709+PierreGtch@users.noreply.github.com>
…rmalizing-layer-names
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.
Thanks @brunaafl for new changes! :)
I added few more comments. Most important, in eegconformer.py
there are 4 "
in two docstrings, so we have to fix that before merge (I have added suggestions). Then, few details with naming attributes or removing old attributes.
@bruAristimunha do you have any idea why tests didn't run on this PR after last commit?
Co-authored-by: Maciej Sliwowski <macieksliwowski@gmail.com>
Co-authored-by: Maciej Sliwowski <macieksliwowski@gmail.com>
Co-authored-by: Maciej Sliwowski <macieksliwowski@gmail.com>
Co-authored-by: Maciej Sliwowski <macieksliwowski@gmail.com>
Co-authored-by: Maciej Sliwowski <macieksliwowski@gmail.com>
Co-authored-by: Maciej Sliwowski <macieksliwowski@gmail.com>
Co-authored-by: Maciej Sliwowski <macieksliwowski@gmail.com>
Co-authored-by: Maciej Sliwowski <macieksliwowski@gmail.com>
Co-authored-by: Maciej Sliwowski <macieksliwowski@gmail.com>
…rmalizing-layer-names
Thank you @brunaafl, @sliwy and @PierreGtch |
Changed last layers' names to final_layer, cf #457.
Fix TIDNet HybridNet's and inheritance (open issue).