Skip to content

Commit

Permalink
Update VITS modeling to enable ONNX export (#28141)
Browse files Browse the repository at this point in the history
* Update vits modeling for onnx export compatibility

* fix style

* Update src/transformers/models/vits/modeling_vits.py
  • Loading branch information
echarlaix authored Jan 5, 2024
1 parent cadf93a commit 7226f3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/transformers/models/vits/modeling_vits.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ def _absolute_position_to_relative_position(self, x):

# Pad along column
x = nn.functional.pad(x, [0, length - 1, 0, 0, 0, 0])
x_flat = x.view([batch_heads, length**2 + length * (length - 1)])
x_flat = x.view([batch_heads, length * (2 * length - 1)])

# Add 0's in the beginning that will skew the elements after reshape
x_flat = nn.functional.pad(x_flat, [length, 0, 0, 0])
Expand Down

0 comments on commit 7226f3d

Please sign in to comment.