nlp-with-transformers / notebooks

Jupyter notebooks for the Natural Language Processing with Transformers book
https://transformersbook.com/
Apache License 2.0
3.92k stars 1.23k forks source link

Potentially unexplained bit of code in the Text Classification chapter #37

Open dmvaldman opened 2 years ago

dmvaldman commented 2 years ago

Information

The question or comment is about chapter:

Question or comment

In the declaration of the method extract_hidden_states in section Transformers as Feature Extractors subsection Extracting the last hidden states, the inclusion of the line if k in tokenizer.model_input_names is not explained in the text. This unexplained line is also a deviation from the previous code demonstrating the behavior of extracting the hidden state for a single line of text. So it tripped me up, personally.