huiyegit / T2I_CL

MIT License
45 stars 16 forks source link

Throwing import error #8

Closed Stelath closed 2 years ago

Stelath commented 2 years ago

I'm very sorry for posting such a simple bug but for the life of me I can't figure out why its throwing this error, I have tried reinstalling numpy and have all the required packages. Numpy even works when running other python files but not here for some reason.

Error:

Traceback (most recent call last):
  File "pretrain_DAMSM.py", line 3, in <module>
    from miscc.utils import mkdir_p
  File "/books-nn/T2I_CL/DM-GAN+CL/code/miscc/utils.py", line 4, in <module>
    from torch.nn import init
ModuleNotFoundError: No module named 'torch'
Stelath commented 2 years ago

This was thrown as a result of me running: sudo python3.7 pretrain_DAMSM.py --cfg cfg/DAMSM/book.yml --gpu 0

Stelath commented 2 years ago

UPDATE: Upon editing the file, it appears that none of the installed modules are able to be imported

Stelath commented 2 years ago
Screen Shot 2021-12-08 at 9 08 08 PM
huiyegit commented 2 years ago

I think the problem is the environment. You'd better create an Anaconda virtual environment to install the required packages. Take it as a reference: https://github.com/huiyegit/APLC_XLNet

Stelath commented 2 years ago

It seems that switching from a python 3.7 conda environment to a python 3.6 conda environment solved the problem, thanks!