Skip to content

Commit

Permalink
Fixing torch.ctc err (#1485)
Browse files Browse the repository at this point in the history
* fixing torch.ctc err

* Move targets & lengths to CPU
  • Loading branch information
teowenshen authored Feb 2, 2024
1 parent b07d547 commit b9e6327
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions egs/librispeech/ASR/zipformer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ def forward_ctc(

ctc_loss = torch.nn.functional.ctc_loss(
log_probs=ctc_output.permute(1, 0, 2), # (T, N, C)
targets=targets,
input_lengths=encoder_out_lens,
target_lengths=target_lengths,
targets=targets.cpu(),
input_lengths=encoder_out_lens.cpu(),
target_lengths=target_lengths.cpu(),
reduction="sum",
)
return ctc_loss
Expand Down

0 comments on commit b9e6327

Please sign in to comment.