Skip to content
Snippets Groups Projects

Draft: Output tensor of logits from DAN prediction for LM rescoring

Closed Thibault Lavigne requested to merge multi-output into main
3 unresolved threads

closes #142 (closed)

Edited by Thibault Lavigne

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
181 187 confidence_scores.append(
182 188 torch.max(torch.softmax(pred[:, :], dim=1), dim=1).values
183 189 )
190 tot_confidence_scores.append(torch.softmax(pred[:, :], dim=1))
  • 202 214 confidence_scores = (
    203 215 torch.cat(confidence_scores, dim=1).cpu().detach().numpy()
    204 216 )
    217 tot_confidence_scores = (
    218 torch.cat(tot_confidence_scores, dim=1).cpu().detach().numpy()
    219 )
    205 220 attention_maps = torch.cat(attention_maps, dim=1).cpu().detach().numpy()
    206 221
    207 222 # Remove bot and eot tokens
    208 223 predicted_tokens = predicted_tokens[:, 1:]
    224 tot_pred = tot_pred[:, 1:, :]
  • 202 214 confidence_scores = (
    203 215 torch.cat(confidence_scores, dim=1).cpu().detach().numpy()
    204 216 )
    217 tot_confidence_scores = (
    218 torch.cat(tot_confidence_scores, dim=1).cpu().detach().numpy()
    219 )
    205 220 attention_maps = torch.cat(attention_maps, dim=1).cpu().detach().numpy()
    206 221
    207 222 # Remove bot and eot tokens
    208 223 predicted_tokens = predicted_tokens[:, 1:]
    224 tot_pred = tot_pred[:, 1:, :]
    209 225 prediction_len[torch.eq(reached_end, False)] = self.max_chars - 1
    210 226 predicted_tokens = [
    211 227 predicted_tokens[i, : prediction_len[i]] for i in range(batch_size)
    212 228 ]
    229 tot_pred = [tot_pred[i, : prediction_len[i], :] for i in range(batch_size)]
  • With tot_pred and predicted_len, you have everything you need to call ctc_decoder like in PyLaia.

    Description Variable name in PyLaia Variable name in DAN
    Batched logits batch_features tot_pred
    Actual sequence size batch_sizes prediction_len

    The only thing is that you will probably need to add fake blank tokens between repeated tokens (otherwise they will be merged).

  • added 1 commit

    Compare with previous version

    By M Generali on 2023-07-27T13:13:55 (imported from GitLab)

  • Marie Generali added 1 commit

    added 1 commit

    Compare with previous version

  • Marie Generali added 1 commit

    added 1 commit

    Compare with previous version

  • Thibault Lavigne assigned to @mgenerali and unassigned @tlavigne

    assigned to @mgenerali and unassigned @tlavigne

  • Marie Generali added 25 commits

    added 25 commits

    Compare with previous version

  • Marie Generali added 2 commits

    added 2 commits

    Compare with previous version

  • Marie Generali added 33 commits

    added 33 commits

    Compare with previous version

  • Marie Generali added 1 commit

    added 1 commit

    Compare with previous version

  • Solene Tarride mentioned in merge request !274 (merged)

    mentioned in merge request !274 (merged)

  • Please register or sign in to reply
    Loading