Skip to content

Commit d9ffd59

Browse files
committed
use static_chunk_size in flow training
1 parent 7902d1c commit d9ffd59

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

Diff for: cosyvoice/transformer/upsample_encoder.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,7 @@ def forward(
286286
xs = self.global_cmvn(xs)
287287
xs, pos_emb, masks = self.embed(xs, masks)
288288
mask_pad = masks # (B, 1, T/subsample_rate)
289-
chunk_masks = add_optional_chunk_mask(xs, masks,
290-
self.use_dynamic_chunk if streaming is True else False,
291-
self.use_dynamic_left_chunk if streaming is True else False,
292-
decoding_chunk_size if streaming is True else 0,
293-
self.static_chunk_size if streaming is True else 0,
294-
num_decoding_left_chunks if streaming is True else -1)
289+
chunk_masks = add_optional_chunk_mask(xs, masks, False, False, 0, self.static_chunk_size if streaming is True else 0, -1)
295290
# lookahead + conformer encoder
296291
xs, _ = self.pre_lookahead_layer(xs)
297292
xs = self.forward_layers(xs, chunk_masks, pos_emb, mask_pad)
@@ -304,12 +299,7 @@ def forward(
304299
masks = ~make_pad_mask(xs_lens, T).unsqueeze(1) # (B, 1, T)
305300
xs, pos_emb, masks = self.up_embed(xs, masks)
306301
mask_pad = masks # (B, 1, T/subsample_rate)
307-
chunk_masks = add_optional_chunk_mask(xs, masks,
308-
self.use_dynamic_chunk if streaming is True else False,
309-
self.use_dynamic_left_chunk if streaming is True else False,
310-
decoding_chunk_size if streaming is True else 0,
311-
self.static_chunk_size * self.up_layer.stride if streaming is True else 0,
312-
num_decoding_left_chunks if streaming is True else -1)
302+
chunk_masks = add_optional_chunk_mask(xs, masks, False, False, 0, self.static_chunk_size * self.up_layer.stride if streaming is True else 0, -1)
313303
xs = self.forward_up_layers(xs, chunk_masks, pos_emb, mask_pad)
314304

315305
if self.normalize_before:

0 commit comments

Comments
 (0)