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

Feed forward layer, frontend and encoder #53

Merged
merged 12 commits into from
May 24, 2024
Merged

Conversation

DanEnergetics
Copy link
Contributor

Implementation of a simple feed forward encoder that serves to generate good alignments in full-sum HMM training. Apart from the layers, it implements a simple convolutional front-end that acts as a feed-forward layer that takes a window of feature time frames into account.

@DanEnergetics DanEnergetics marked this pull request as draft May 14, 2024 12:53
@DanEnergetics DanEnergetics marked this pull request as ready for review May 14, 2024 13:10
i6_models/parts/ffnn.py Outdated Show resolved Hide resolved
i6_models/parts/frontend/window_ffnn.py Outdated Show resolved Hide resolved
i6_models/parts/frontend/window_ffnn.py Outdated Show resolved Hide resolved
x = x.transpose(1, 2) # torch 1d convolution is over last dim but we want time conv
x = self.conv(x).transpose(1, 2)

# these settings apparently apply stride correctly to the masking whatever the kernel size
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# these settings apparently apply stride correctly to the masking whatever the kernel size
# change masking according to stride value

do be confident about the implementation of others xP

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I was not confident in my own implementation here. I had to choose kernel_size = 1 and padding = 0 to achieve correct masking, which is not how this function is supposed to be used I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

And with kernel_size = cfg.window_size and padding = get_same_padding(cfg.window_size) (i.e. the values given to Conv1d) it does not work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Weirdly enough yes. I came up with a failing test case in a new branch

def test_masking():

i6_models/parts/frontend/window_ffnn.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Atticus1806 Atticus1806 left a comment

Choose a reason for hiding this comment

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

Only small comments regarding documentation, else looks good to me.

i6_models/parts/ffnn.py Outdated Show resolved Hide resolved
i6_models/parts/ffnn.py Outdated Show resolved Hide resolved
i6_models/parts/frontend/window_ffnn.py Outdated Show resolved Hide resolved
i6_models/parts/frontend/window_ffnn.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Atticus1806 Atticus1806 left a comment

Choose a reason for hiding this comment

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

Took the liberty to commit one last change :)

@DanEnergetics DanEnergetics merged commit 83ff39e into main May 24, 2024
2 checks passed
@DanEnergetics DanEnergetics deleted the mann_ffnn_encoder branch May 24, 2024 10:23
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