Unable to import transformers using my jupyter notebook

Hello – I’m just now starting the Transformer lab. I just scanned a lot of the comments, and I can see this going to be a real challenge. My mode of working during this course has been to download all the lab files and work them in on my Jupyter notebook. That works good for me since I often have to leave the computer which on the Coursera website would result in lots of session time outs. I’ve routinely encountered solvable issues where a particular library needed to be imported that was not already in my environment. This time, however, I am not able to import transformers when running the following statements near the beginning of the lab. I will work in the Coursera environment for now, but I’d really like to end up with my own working version of this lab. Any help with this manner would be appreciated.

from transformers import DistilBertTokenizerFast #, TFDistilBertModel
from transformers import TFDistilBertForTokenClassification

The APIs of all the packages we use are not stable over time. Most of the notebooks in the course were last updated in a major way in April of 2021. There is no guarantee that they will work with the current version of TF/Keras or any of the other packages. If you want to work in your local environment, you have a fundamental choice to make:

  1. Duplicate the versions of all the packages using something like Conda.
  2. Solve each compatibility problem as you encounter it.

If you want to explore the “duplicate versions” strategy, there are no official instructions, but here’s a thread that has lots of useful information to get you started down that long and winding road.

Thanks Paul - I’ve been solving compatibility issues as they’ve come up but it looks like its not worth the time in this case. Thanks for confirming - I’ll just work in the Coursera environment.
Marc

1 Like