I noticed a small inconsistency at the end of Chapter 2, Part 3.
The example shows:
encoded_sequences = [
[...], # length 16
[...], # length 8
]
model_inputs = torch.tensor(encoded_sequences)
Since the two sequences have different lengths, torch.tensor(encoded_sequences) will raise an error because tensors require all rows to have the same length.
A simple fix would be to make encoded_sequences rectangular by padding the shorter sequence before converting it to a tensor. This would make the example consistent with the explanation.
Thanks for the great course!
I noticed a small inconsistency at the end of Chapter 2, Part 3.
The example shows:
encoded_sequences = [
[...], # length 16
[...], # length 8
]
model_inputs = torch.tensor(encoded_sequences)
Since the two sequences have different lengths, torch.tensor(encoded_sequences) will raise an error because tensors require all rows to have the same length.
A simple fix would be to make encoded_sequences rectangular by padding the shorter sequence before converting it to a tensor. This would make the example consistent with the explanation.
Thanks for the great course!