Closed telele77 closed 4 years ago
Hello @telele77 ,
Thanks for your interest. A similar concern has been reported here (#7). Updating your PYTHONPATH
to contain the current directory would make it easier to search for the module.
Run the following (once) in your command line:
export PYTHONPATH="."
Hope this helps!-
Hello @satwikkottur
Thanks for the solution. In my case, after running the command export PYTHONPATH="."
in simmc/mm_action_prediction/ directory, it shows the same error message.
My operating system is Ubunto 18.04 and using python 3.6.9.
After searching for solutions on internet, this may be some kind of circular import issue? Since using 'import ... as ...' in /simmc/mm_action_prediction/models/encoders/history_agnostic.py will have to wait for the whole module loaded and the modules models and models.encoders are still waiting for history_agnostic.py to be done importing.
The above problem is just my guess.
I fix this error by changing all
import models.encoders as encoders
to
from models import encoders
in four scripts: hierarchical_recurrent.py history_agnostic.py memory_network.py tf_idf_encoder.py
Thank for you for your suggestion @billkunghappy. I'll add this to the README.md.
Hi! I tried to run scripts/train_simmc_model.sh then got some errors
(simmc) telele77:~/simmc/mm_action_prediction$ scripts/train_simmc_model.sh Traceback (most recent call last): File "eval_simmc_agent.py", line 15, in
import models
File "/simmc/mm_action_prediction/models/init.py", line 4, in
from .assistant import Assistant
File "/simmc/mm_action_prediction/models/assistant.py", line 12, in
import models.encoders as encoders
File "/simmc/mm_action_prediction/models/encoders/init.py", line 21, in
from .history_agnostic import HistoryAgnosticEncoder
File "/simmc/mm_action_prediction/models/encoders/history_agnostic.py", line 15, in
import models.encoders as encoders
AttributeError: module 'models' has no attribute 'encoders'
I think "models" is just a directory, How can I import it right away?