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

Optimise as_windowed and apply :reflect padding to the whole input #17

Merged
merged 3 commits into from
Aug 30, 2023

Conversation

jonatanklosko
Copy link
Member

@jonatanklosko jonatanklosko commented Aug 30, 2023

Changes to indexed_add to put_slice.

Also, instead of applying :reflect padding within each incomplete window, we apply it to the input sequence at the beginning. This is what torch.stft does and what huggingface/transformers do in pre-processing.

@jonatanklosko jonatanklosko changed the title Use put_slice instead of indexed_add Optimise as_windowed and apply :reflect padding to the whole input Aug 30, 2023
Keyword.put(opts, :padding, [{div(window_length, 2), div(window_length, 2) - 1}])
Keyword.put(opts, :padding, [{div(window_length, 2), div(window_length, 2)}])
Copy link
Member Author

Choose a reason for hiding this comment

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

@polvalente this changes some output shapes (the currently failing tests), but that's what torch.stft does. wdyt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it just decrease the number of windows?

Copy link
Member Author

Choose a reason for hiding this comment

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

The opposite, it adds an extra window, where half of the window is padded.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's ok then

@jonatanklosko jonatanklosko merged commit 4f1ee15 into main Aug 30, 2023
2 checks passed
@jonatanklosko jonatanklosko deleted the jk-window-building branch August 30, 2023 17:06
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.

None yet

2 participants