ModuleNotFoundError when running celebahq or ade20k models (possibly others)

Some of the VQGAN models rely on Python modules that aren’t installed by default, but it’s a quick fix to set this up…

Near the top of the window are some options, “+ Code,” “+ Text” and so forth. Click on “+ Code” to insert a new cell below whatever job currently has focus. Its position in the sequence really doesn’t matter.

In the resulting cell, type:

!pip install transformers

(Include the initial “!” character, that’s important.)

Then click the “Run job” icon, and you’ll see a progress bar as it installs. Only takes a moment.

That’s it! Now you can go back and run the “Execute” job. You only need to run this “pip” operation one time for the whole session, it sticks around until you close the window.

NameError: name 'torch' is not defined (or sometimes 'argparse')

Occasionally you’ll get this when a session idles out or becomes disconnected. Re-run the “Instalación de bibliotecas” (“Installation of libraries”) and/or “Carga de bibliotecas y definiciones” (“Loading libraries and definitions”) jobs, then try the Execute job again.

If that doesn’t fix it, sometimes you just have to reload the whole page and start over.

This guide was first published on Jul 21, 2021. It was last updated on Jul 21, 2021.

This page (Troubleshooting and Notes) was last updated on Jun 30, 2022.

Text editor powered by tinymce.