diff --git a/chapters/en/chapter2/3.mdx b/chapters/en/chapter2/3.mdx index cf6309eb1..a11cdc8b9 100644 --- a/chapters/en/chapter2/3.mdx +++ b/chapters/en/chapter2/3.mdx @@ -277,21 +277,11 @@ encoded_sequences = [ ] ``` -This is a list of encoded sequences: a list of lists. Tensors only accept rectangular shapes (think matrices). This "array" is already of rectangular shape, so converting it to a tensor is easy: +This is a list of encoded sequences: a list of lists. As you can see, the lengths of the tokenized outputs are different. Tensors require a "rectangular" shape (like a matrix), so you won't be able to convert this list of lists directly to a tensor. To resolve this, you need to use padding, as we saw earlier. -```py -import torch - -model_inputs = torch.tensor(encoded_sequences) -``` - -### Using the tensors as inputs to the model[[using-the-tensors-as-inputs-to-the-model]] +### Using the tensors as inputs to the model [[using-the-tensors-as-inputs-to-the-model]] -Making use of the tensors with the model is extremely simple — we just call the model with the inputs: - -```py -output = model(model_inputs) -``` +Making use of the tensors with the model is extremely simple... While the model accepts a lot of different arguments, only the input IDs are necessary. We'll explain what the other arguments do and when they are required later, but first we need to take a closer look at the tokenizers that build the inputs that a Transformer model can understand.