SongUNetPosEmbed has the option to disable positional embeding by setting N_grid_channels to 0. This change keeps the forward pass from crashing by adding a check to make sure the positional embedding exists. It also elimates some code duplication between the positional embed and non-positional embed version.
Modulus Pull Request
Description
SongUNetPosEmbed has the option to disable positional embeding by setting
N_grid_channels
to 0. This change keeps the forward pass from crashing by adding a check to make sure the positional embedding exists. It also elimates some code duplication between the positional embed and non-positional embed version.Closes https://github.com/NVIDIA/modulus/issues/504
Closes https://github.com/NVIDIA/modulus/issues/529
Checklist
Dependencies