ModuleNotFoundError: No module named '__main__.hparams'; '__main__' is not a package
Ye-XX opened this issue · 7 comments
Ye-XX commented
Hello,I have a question to ask you. I hope you can help me solve it. I did the calculation according to your method, and the following problem occurred in the second step. I've tried my best to solve it, but I still can't.Questions as follows:
E:\WorkSpace\venv\Scripts\python.exe E:/WorkSpace/CipherGAN/train.py
Traceback (most recent call last):
File "E:/WorkSpace/CipherGAN/train.py", line 5, in
from .hparams.registry import get_hparams
ModuleNotFoundError: No module named 'main.hparams'; 'main' is not a package
bryanlimy commented
Hi, what was the command you used to run train.py?
w632752464 commented
Follow your instructions.
train.py
--output_dir=runs/vig345
--test_name="vigenere345-brown200-eval*"
--train_name="vigenere345-brown200-train*"
--hparam_sets=vigenere_brown_vocab_200
bryanlimy commented
please try using -m
, and run the command outside of the CipherGAN folder.
python -m CipherGAN.train \
--output_dir=runs/vig345 \
--test_name="vigenere345-brown200-eval*" \
--train_name="vigenere345-brown200-train*" \
--hparam_sets=vigenere_brown_vocab_200
bryanlimy commented
Hi @w632752464 are you able to test with the above command?
w632752464 commented
Sorry,I have been busy recently, and I tried it this morning and it is ok. The reason: Instead of downloading zip, should downloaded the source code using git. After downloading it, according to your step and it is ok.
w632752464 commented
Thank you for your sincere reply!
bryanlimy commented
I am closing this issue now, please create a new one if you experience any other problem :)