Skip to content

Commit 4357cfb

Browse files
update modeling_mim.py
1 parent 499158f commit 4357cfb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

mindnlp/transformers/models/mimi/modeling_mimi.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,13 @@ def _get_extra_padding_for_conv1d(
182182

183183
@staticmethod
184184
# Copied from transformers.models.encodec.modeling_encodec.EncodecConv1d._pad1d
185-
def _pad1d(hidden_states: ms.Tensor, paddings: Tuple[int, int], mode: str = "zero", value: float = 0.0):
186-
"""Tiny wrapper around mindspore.nn.functional.pad, just to allow for reflect padding on small input.
185+
def _pad1d(hidden_states: ms.Tensor, paddings: Tuple[int, int], mode: str = "zero", value: float = None):
186+
"""Tiny wrapper around mindnlp.core.nn.functional.pad, just to allow for reflect padding on small input.
187187
If this is the case, we insert extra 0 padding to the right before the reflection happens.
188188
"""
189189
length = hidden_states.shape[-1]
190190
padding_left, padding_right = paddings
191-
paddings = (int(padding_left), int(padding_right))
192-
if mode != "reflect":
191+
if not mode == "reflect":
193192
# "ConstantPadND()(input=<Tensor>, padding=<list of int, Tensor, tuple of int>, value=<Number>)".
194193
return nn.functional.pad(hidden_states, paddings, mode, value)
195194

0 commit comments

Comments
 (0)