Skip to content
This repository has been archived by the owner on Oct 31, 2022. It is now read-only.

Error on running Encode.py: "ModuleNotFoundError: No module named 'regex'" #54

Open
samysa-kr opened this issue Jul 9, 2020 · 2 comments

Comments

@samysa-kr
Copy link

samysa-kr commented Jul 9, 2020

I started a new installation of GPT-2 using this fork of the project, following the directions in https://www.youtube.com/watch?v=4iK-IuvatxI (for training) and https://lambdalabs.com/blog/run-openais-new-gpt-2-text-generator-code-with-your-gpu/ (for setting up the environment). This means I'm following the video instructions for training, but running everything using venv-gpt-2.

When I try
(venv-gpt-2) me@mypc:~/Finetuning/gpt-2/src$ sudo python3 encode.py training.txt training.npz

I'm getting

Traceback (most recent call last): File "encode.py", line 9, in <module> import encoder File "/home/samy/Finetuning/gpt-2/src/encoder.py", line 5, in <module> import regex as re ModuleNotFoundError: No module named 'regex'

However the package is installed, since running
(venv-gpt-2) me@mypc:~/Finetuning/gpt-2/src$ python3 -m pip install regex
returns
Requirement already satisfied: regex in /home/samy/venv-gpt-666/lib/python3.6/site-packages

The packages were installed using
(venv-gpt-2) me@mypc:~/Finetuning/gpt-2$ pip install -r requirements.txt

I can also confirm that I can run GPT-2 normally by executing interactive_conditional_samples.py on venv-gpt-2, as instructed in https://lambdalabs.com/blog/run-openais-new-gpt-2-text-generator-code-with-your-gpu/. Everything runs normally there, I get a prompt, I can give the algorithm a new seed and generate text. The only issue would be on training it with new text.

All help to solve this issue will be deeply appreciated.

@samysa-kr
Copy link
Author

I was able to overcome this on my own following instructions from https://askubuntu.com/questions/1131888/e-unable-to-locate-package-regex. The solution, apparently, was to install the package globally on my system.

sudo add-apt-repository universe (already installed in my case)
sudo apt update
sudo apt install python3-regex (for Python 3)

@shreesha345
Copy link

shreesha345 commented Feb 7, 2021

i am using windows10 and i am getting error for "Error on running Encode.py: "ModuleNotFoundError: No module named 'encoder'""
but I had installed it.
please help me with this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants