speechbrain/speechbrain

Error during encoding

husnejahan opened this issue · 0 comments

Describe the bug

    code: # Unpacking inputs
    inp_lens = [len(chars) for chars in batch.ignotush_encoded_chars]
    enc_ignotush = batch.ignotush_encoded_chars

    # Assuming enc_ignotush is a tensor
    enc_ignotush_tensor = enc_ignotush.data.to(self.device)
    inp_lens_tensor = torch.tensor(inp_lens).to(self.device)
    
    # Assuming enc_emb is a torch tensor of shape [batch_size, max_seq_length, embedding_dim]
    # Input embeddings
    enc_emb = self.hparams.encoder_emb(enc_ignotush_tensor)

   # Use inp_lens_tensor for encoding
    try:
        encoded_signal, _ = self.modules.encoder(enc_emb, lengths=inp_lens_tensor)
    except Exception as e:
        print("Error during encoding:", e)

Output:

Shapes: enc_emb = torch.Size([100, 74, 128]) , inp_lens_tensor = torch.Size([100])

Lengths in inp_lens_tensor: tensor([53, 68, 40, 62, 43, 67, 28, 66, 60, 49, 34, 71, 50, 60, 11, 46, 44, 37,
69, 68, 32, 22, 61, 61, 55, 65, 61, 36, 41, 61, 43, 40, 40, 39, 51, 42,
68, 24, 47, 42, 63, 55, 47, 52, 63, 32, 11, 46, 61, 49, 74, 64, 42, 44,
27, 35, 44, 59, 54, 53, 63, 48, 58, 38, 51, 70, 45, 49, 64, 54, 46, 59,
48, 52, 62, 35, 68, 53, 69, 25, 62, 63, 66, 39, 31, 57, 63, 50, 53, 39,
32, 34, 43, 39, 56, 62, 44, 48, 49, 53])

Error during encoding: start (7400) + length (100) exceeds dimension size (7400).

Expected behaviour

Error during encoding: start (7400) + length (100) exceeds dimension size (7400).

To Reproduce

No response

Environment Details

No response

Relevant Log Output

No response

Additional Context

train.csv