Skip to content
Advertisement

Hugging Face: NameError: name ‘sentences’ is not defined

I am following this tutorial here: https://huggingface.co/transformers/training.html – though, I am coming across an error, and I think the tutorial is missing an import, but i do not know which.

These are my current imports:

JavaScript

Current code:

JavaScript
JavaScript
JavaScript

The error:

JavaScript

Advertisement

Answer

The error states that you do not have a variable called sentences in the scope. I believe the tutorial presumes you already have a list of sentences and are tokenizing it.

Have a look at the documentation The first argument can be either a string or list of string or list of list of strings.

JavaScript
Advertisement