[ ] Did you make sure to update the docs?
No; I didn't find docs in the repo.
[ ] Did you write any new necessary tests?
Not applicable.
What does this PR do?
In the fairseq SinusoidalPositionalEmbedding module, when the input length exceeds the number of pre-computed embeddings, the embeddings are expanded and written back to the weights field of the module.
However, mutating fields of a module can cause subtle bugs in multithreading environments.
This diff provides an auto_expand option to SinusoidalPositionalEmbedding to control whether the expanded embeddings are written back to the module.
The default is set to True, so the default behavior is not changed.
If you encounter bugs in multithreading environments, set auto_expand=False.
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Before submitting
What does this PR do?
In the fairseq SinusoidalPositionalEmbedding module, when the input length exceeds the number of pre-computed embeddings, the embeddings are expanded and written back to the weights field of the module. However, mutating fields of a module can cause subtle bugs in multithreading environments. This diff provides an auto_expand option to SinusoidalPositionalEmbedding to control whether the expanded embeddings are written back to the module. The default is set to True, so the default behavior is not changed. If you encounter bugs in multithreading environments, set auto_expand=False.
PR review
Anyone in the community is free to review the PR once the tests have passed. If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃