Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during encoding #2408

Open
husnejahan opened this issue Feb 12, 2024 · 0 comments
Open

Error during encoding #2408

husnejahan opened this issue Feb 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@husnejahan
Copy link

husnejahan commented Feb 12, 2024

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

@husnejahan husnejahan added the bug Something isn't working label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant