I'm running a GAN training pipeline in Google Colab. The preprocessing scripts run without any issues:
!python run_preprocess.py --dataset custom --train_num 500
!python run_preprocess.py --dataset custom --train_num 500 --sample_num 1000
Loading raw data...
Saving train and test real data...
Done preprocessing
However, when I try to run the training script:
!python run_train.py --dataset custom --seq_len 24 --batch_size 128
Traceback (most recent call last):
File "/content/run_train.py", line 8, in
from model import Generator, Critic
ImportError: cannot import name 'Generator' from 'model' (unknown location)
I’ve checked: There is a file named model.py in my working directory. I’ve confirmed that model.py defines Critic but not Generator. I suspect that the Generator is either missing or has a different name in model.py.
Please help me resolve this error.
I expected the training script (run_train.py) to import the Generator and Critic classes from the model.py file and begin training the GAN model without issues.
Here’s what I’ve tried so far:
Checked that model.py exists in the same directory as run_train.py.
Opened model.py and verified that the Critic class is defined, but couldn’t find a class named Generator.
Tried renaming and reimporting, and also added some debug prints to ensure the correct module is being loaded.
Restarted the Colab runtime to rule out any caching issues.
I was expecting the script to start training after loading the model, but it fails at the import step with the error:
ImportError: cannot import name 'Generator' from 'model' (unknown location)