Errata

Natural Language Processing with Transformers

Errata for Natural Language Processing with Transformers

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 1
1

There is a mistake in the discussion of BLEU and ROUGE scores in Chapter 6: Summarization.

First:
[...] which means that when we compare the two texts we count the number of words in the generation that occur in the reference and divide it by the length of the reference.

Should be:
[...] which means that when we compare the two texts we count the number of words in the generation that occur in the reference and divide it by the length of the generation.

Then in the two equations for p_n the apostrophe with snt should be in the numerator of the fraction and not in the denominator.

Finally, in the first paragraph of the ROUGE section the text:
[...] occurrence of reference n-grams in the generated text in the numerator:

Should be replaced with:
[...] occurrence of reference n-grams in the generated text in the denominator:

Leandro von Werra
 
Feb 05, 2022  May 27, 2022
Page 4
2nd line from the bottom

(First Release)
In figure 1-4, the attention focus for predicting second token('sind'), not thrid('grossartig'). So, 'predicting the third token' should be 'predicting the second token'.
Thanks.

Note from the Author or Editor:
Correct, we'll fix it.

Haesun Park  Jun 18, 2022 
Page 48
1st code block

(Fist Release)
To load the best model at the end of training (as mentioned in first paragraph), `save_strategy="epoch"` and `load_best_model_at_end=True` is added to `TrainingArguments` constructor.
Thanks.

Haesun Park  Jun 18, 2022 
Page 67
12th line from the top

It says "dot product of a query with itself is always 1".
Please let me know how dot product of randomly initialized query with itself is always 1.
Thanks.

Note from the Author or Editor:
Indeed, that would only hold if q and k were normalized. Will remove that statement.

Haesun Park  Jun 23, 2022 
Page 97
End of 3rd paragraph

If one decides to tag the subwords using the tag of the first subword, in this case the "#ista" subword should be tagged as B-PER not as B-LOC has indicated in the book.

Note from the Author or Editor:
Indeed, that's a typo we intend to fix in the next version of the book. Thanks for reporting.

Cheers, Leandro

Jerome Massot  May 26, 2022 
Printed,
Page 102
Final code block for the tag_text() function

This line of code in the function

outputs = model(inputs)[0]

should be replaced with

outputs = model(input_ids)[0]

Reference PR on the GitHub repo: https://github.com/nlp-with-transformers/notebooks/pull/34/files

Lewis Tunstall
Lewis Tunstall
 
Mar 23, 2022  May 27, 2022
Page 161
last lines of p. 161

On p. 161, a model is instantiated and trained using the Trainer.
Then, evaluate_summaries_pegasus is called, but the model is still in train mode. Shouldn't you write
something like trainer.model.eval() between trainer.train() and score = evaluate_summaries_pegasus?

Note from the Author or Editor:
Indeed, that's the correct way to evaluate the model. Thanks for reporting.

Cheers, Leandro

Frederick Riemenschneider  Mar 28, 2022