huggingface / huggingface/course
Incorrect content in Chapter 2 3.mdx: Why is all of this necessary?
- Dominant language
- MDX
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 13m
- Merged PRs (30d)
- 1
Description
Under the sub-heading:
__`Why is all of this necessary?`__
When the sequences are encoded, the encoded sequences are shown as:
```
encoded_sequences = [
[
101,
1045,
1005,
2310,
2042,
3403,
2005,
1037,
17662,
12172,
2607,
2026,
2878,
2166,
1012,
102,
],
[101, 1045, 5223, 2023, 2061, 2172, 999, 102],
]
```
However, it is mentioned that `This "array" is already of rectangular shape` which is incorrect. And this leads to a `ValueError: expected sequence of length 16 at dim 1 (got 8)` when converting to `tensors` using:
`model_inputs = torch.tensor(encoded_sequences) `
__Possible corrections:__
1. Extend list 2 with 0s to match length of list 1.
2. Truncate list 1 to match length of list 2.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.