-
Notifications
You must be signed in to change notification settings - Fork 164
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
What's the need for a different positional encoding? #30
Comments
Let's answer the question here, once and for all ! In my case, i'm less interested in knowing which day comes before the next, as I am to tell the Transformer about day/night cycles. This is what the "regular" PE is about, it's just a |
When using the Transformer model, can we somehow pass a new sequence length to the |
Sure, you can change this value when generating the |
My use case is time series prediction for a spectrogram, so 24 isn’t enough. If you’re up for it, I can make a PR that takes a |
In practice, adding PE does not always improve performances. If you still want to use |
Will do. But I’m curious why a |
They would, and I couldn't tell you exactly why it still works. Instead, I comfort myself in thinking that the networks simply "pays attention" to related time steps, which happens to be the one you expect. In this example on a month's data, you can see that the Transformer shows day/night cycles, as well as week/weekend, even though there are no PE added. |
#35 - PR up. Please let me know if I have to make any edits |
PR was merged, closing. |
@maxjcohen Have you done a benchmark showing the improved performance of "regular" vs "original" method of positional encoding? |
Have you got a hypothesis on how it was possible for the network to still learn effectively without the PE? (I know you said you don't know in the comment above^^^ but that was half a year ago now). |
I assumed the cyclic nature of the data already strongly encourages the network to learn effectively. For instance, you can see in the example with no PE that the attention map looks very regular (day/night and week/weekend cycles appear clearly). |
I’d love to see how this library works for a variety of datasets. Maybe there’s a paper in it. Any collaborators? We can evaluate it for various time series data (weather, stocks, audio, etc) to establish “best practices for transformers” |
transformer/tst/utils.py
Line 32 in 1ac4b34
Looks like this one is just
sin
?The text was updated successfully, but these errors were encountered: