2

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

enter image description here

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

Sᴀᴍ Onᴇᴌᴀ
  • 8,218
  • 8
  • 36
  • 58
Lee
  • 49
  • 1
  • 1
  • 3
  • 1
    Please don't use links, copy and paste your code and the error into your question. Does the module load using a command-line program? – cdarke Jan 12 '17 at 10:10
  • Can you show the rest of the program? it could tell us which packages you'd need to install (e.g. is your program using `keras` or `tflearn`?) – bakkal Jan 12 '17 at 10:33
  • This question seems to be already answered here: http://stackoverflow.com/questions/35905264/keras-importerror-no-module-named-data-utils – Diego Jan 12 '17 at 10:52
  • I'm not using Keras, I'm not sure about tflearn. I'm just using powershell to open tensorflow in jupyter notebook with docker. I'm just attempting to follow a tutorial on youtube. Haven't got as far yet – Lee Jan 12 '17 at 13:01

6 Answers6

2

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.

JimLohse
  • 1,209
  • 4
  • 19
  • 44
Nikhil Yadav
  • 97
  • 2
  • 11
  • Nice! Would be nicer to show how to add this to Python or Anaconda install to setup in an environment, this is only good for this single project. – JimLohse Jul 30 '17 at 21:24
1

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.

c-chavez
  • 7,237
  • 5
  • 35
  • 49
0

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

Community
  • 1
  • 1
ooknosi
  • 374
  • 1
  • 2
  • 8
  • I'm not using Keras, or rather I'm not exactly sure if I should use Keras. What I'm doing right now is run docker, then run tensorflow in jupyter notebook – Lee Jan 12 '17 at 12:59
  • Then you're probably missing data_utils because you haven't installed a package containing data_utils. Do you have a link to the tutorial you're referring to? – ooknosi Jan 12 '17 at 15:26
  • Do I use pip to install the package then? Yes, here it is. https://youtu.be/SJDEOWLHYVo?list=PL2-dafEMk2A7EEME489DsI468AB0wQsMV&t=213 . – Lee Jan 12 '17 at 15:51
  • Yes, run the following: pip install numpy scipy six tensorflow – ooknosi Jan 12 '17 at 16:10
  • Thank you! Pardon my ignorance, but I'm really new to this. What do you mean by cloning, cd and run? – Lee Jan 13 '17 at 02:20
  • 2
    I'm referring to terminal commands. [Cloning](https://git-scm.com/docs/git-clone) is when you duplicate a git repository. [cd](https://en.wikipedia.org/wiki/Cd_(command)) means change directory. Run as in run the command in your terminal. If you're new to python, learning how to use the command line, the programming language, git, neural nets and machine learning modules at the same time can be overwhelming. Perhaps start with python basics first? – ooknosi Jan 13 '17 at 02:27
  • 1
    This should be the accepted answer @Lee, FeebleOldMan did a good job explaining things here! – JimLohse Jul 31 '17 at 16:00
0

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.

Blodstone
  • 325
  • 2
  • 8
0

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
Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
0

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

K.Dᴀᴠɪs
  • 9,945
  • 11
  • 33
  • 43