ImportError: No module named data_utils

故事扮演 提交于 2019-12-23 03:57:28

问题


I'm extremely new to python and I'm recently trying to understand more about Machine Learning and Neural Nets

I know this is a trivial question but I seem to be having problem importing data_utils on jupyter notebook. Can anyone please help

Note: I am not using Keras, and I am following the tutorial in this video.


回答1:


I was also following the video and went through the same issue, after searching for a while; Here is the link from Github tensorflow_chatbot_required_files. You can download from here and copy it to your working directory (python file directory).

Now you will be able to import both.




回答2:


Based on the link that you provided for the video you are using, go to this link and download both files into your working directory.

The files you need to download are data_utils and seq2seq_model.

But before doing this tutorial try the tensorflow tutorials found on the tensorflow website, to get you started with this library.

Also, if you are very new to python, I recommend this tutorial first.




回答3:


Since you mentioned about Machine Learning and Neural Nets, I'll assume you're referring to Keras.

I'll also assume that you installed it via

pip install keras

In that case, you need to uninstall it first by running

pip uninstall keras

Then, clone it from Github, cd into its directory and run

sudo python setup.py install

More information here




回答4:


I'm assuming you are using code from tensorflow's github, in that case you need to download https://github.com/tensorflow/models/blob/master/tutorials/rnn/translate/data_utils.py into your folder also.




回答5:


what you are trying to do is importing a self-defined module, in order to do that do as follow:

in your case the module is called 'data_util' which contains functions that will be called later as data_util.'function name'.

let say that the data_util which is a python file (.py) is in this directory (C:/Users/xxx/modules), so all what you have to do is to run this line of code in order for python to find your modul when you call import data_util:

import sys  
sys.path.append('C:/Users/xxx/modules')  
import data_util



回答6:


I too was using same files. Just open seq2seq_model.py and in line 35 remove from TensorFlow and keep it just import dat_



来源:https://stackoverflow.com/questions/41609678/importerror-no-module-named-data-utils

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!