rahulremanan / python_tutorial

Python 3 tutorial for machine learning and natural language processing.
MIT License
33 stars 40 forks source link

TypeError on Mac: Expected int32, got list containing Tensors #3

Closed JoieQuinn closed 7 years ago

JoieQuinn commented 7 years ago

Screenshot: screen shot 2017-08-21 at 10 52 50 am

JoieQuinn commented 7 years ago

Python version 3.5.2

rahulremanan commented 7 years ago

For the error: "expected int32 got list containing tensors of type _'message' instead": This is what I would do...

Wildcard solution : Step 1 - sudo pip3 uninstall keras Step 2 - sudo pip3 install keras Step 3 - sudo pip3 install tensorflow

.... let me know if this works.... ....if not....

Lazy solution: Try editing keras.json file: Step 1: cd ~/home Step 2: cd .keras ls and check if there is a keras.json file Step 3: Open the keras.json file in a text editor and swap the back-end by changing the "backend": flag from 'tensorflow' to 'theano'. Save the json file that looks something like this: { "image_data_format": "channels_last", "epsilon": 1e-07, "floatx": "float32", "backend": "theano, } Step 4: sudo pip3 install theano Step 5: Run the 02_Twitter_bot_LSTM.py file

Hard solution: Nuke the environment and perform a clean install of everything and try running the file afterwards --OR-- Create a shiny new virtualenv and run everything inside it.

JoieQuinn commented 7 years ago

Hi! Thanks for the help! I have had a week of job interviews, so this is the first time I have been able to look at it. It runs now, though it's doing an awful lot of this:

...2673/2673 [==============================] - 17s - loss: 4.4598e-11 Epoch 35/60 2560/2673 [===========================>..] - ETA: 0s - loss: 4.6566e-11Epoch 00034: loss did not improve 2673/2673 [==============================] - 15s - loss: 4.4598e-11 Epoch 36/60 2560/2673 [===========================>..] - ETA: 0s - loss: 9.3132e-11Epoch 00035: loss did not improve 2673/2673 [==============================] - 14s - loss: 8.9195e-11 Epoch 37/60 2560/2673 [===========================>..] - ETA: 0s - loss: 0.0000e+00Epoch 00036: loss did not improve 2673/2673 [==============================] - 14s - loss: 4.4598e-11 Epoch 38/60...

Is that what I'm hoping for?

I uninstalled tensorflow first. These are the commands in order:

Step 1 - sudo -H pip3 uninstall tensorflow Step 2 - sudo -H pip3 uninstall keras Step 3 - sudo -H pip3 install keras Step 4 - sudo -H pip3 install tensorflow

I needed the -H flag because it was saying that I didn't own some of the directories.

Thanks for your help, and enjoy your holiday!

Joanne

On Mon, Aug 21, 2017 at 8:45 PM, Rahul Remanan notifications@github.com wrote:

For the error: "expected int32 got list containing tensors of type _'message' instead": This is what I would do... Wildcard solution : Step 1 - sudo pip3 uninstall keras Step 2 - sudo pip3 install keras Step 3 - sudo pip3 install tensorflow

.... let me know if this works.... ....if not....

Lazy solution: Try editing keras.json file: Step 1: cd ~/home Step 2: cd .keras ls and check if there is a keras.json file Step 3: Open the keras.json file in a text editor and swap the back-end by changing the "backend": flag from 'tensorflow' to 'theano'. Save the json file that looks something like this: { "image_data_format": "channels_last", "epsilon": 1e-07, "floatx": "float32", "backend": "theano, } Step 4: sudo pip3 install theano Step 5: Run the 02_Twitter_bot_LSTM.py file

Hard solution: Nuke the environment and perform a clean install of everything and try running the file afterwards --OR-- Create a shiny new virtualenv and run everything inside it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rahulremanan/python_tutorial/issues/3#issuecomment-323887976, or mute the thread https://github.com/notifications/unsubscribe-auth/AT4giOjAJZ5AeoYyL5Cok0rGUqL6_tEAks5saiShgaJpZM4O9dG8 .

rahulremanan commented 7 years ago

Dear Joanne,

Great. The best code is the last one in the set. The sixth demo: QA system is a stacked LSTM. Using 1337 epochs I achieved a peak accuracy of 99.6% for the single task bAbI dataset.

I am glad the tensorflow issue is resolved.

Good luck with the job interviews.

Looking forward to the meeting again on 17th.

Best,

Rahul

On Aug 29, 2017, at 5:01 PM, JoieQuinn notifications@github.com wrote:

Hi! Thanks for the help! I have had a week of job interviews, so this is the first time I have been able to look at it. It runs now, though it's doing an awful lot of this:

...2673/2673 [==============================] - 17s - loss: 4.4598e-11 Epoch 35/60 2560/2673 [===========================>..] - ETA: 0s - loss: 4.6566e-11Epoch 00034: loss did not improve 2673/2673 [==============================] - 15s - loss: 4.4598e-11 Epoch 36/60 2560/2673 [===========================>..] - ETA: 0s - loss: 9.3132e-11Epoch 00035: loss did not improve 2673/2673 [==============================] - 14s - loss: 8.9195e-11 Epoch 37/60 2560/2673 [===========================>..] - ETA: 0s - loss: 0.0000e+00Epoch 00036: loss did not improve 2673/2673 [==============================] - 14s - loss: 4.4598e-11 Epoch 38/60...

Is that what I'm hoping for?

I uninstalled tensorflow first. These are the commands in order:

Step 1 - sudo -H pip3 uninstall tensorflow Step 2 - sudo -H pip3 uninstall keras Step 3 - sudo -H pip3 install keras Step 4 - sudo -H pip3 install tensorflow

I needed the -H flag because it was saying that I didn't own some of the directories.

Thanks for your help, and enjoy your holiday!

Joanne

On Mon, Aug 21, 2017 at 8:45 PM, Rahul Remanan notifications@github.com wrote:

For the error: "expected int32 got list containing tensors of type _'message' instead": This is what I would do... Wildcard solution : Step 1 - sudo pip3 uninstall keras Step 2 - sudo pip3 install keras Step 3 - sudo pip3 install tensorflow

.... let me know if this works.... ....if not....

Lazy solution: Try editing keras.json file: Step 1: cd ~/home Step 2: cd .keras ls and check if there is a keras.json file Step 3: Open the keras.json file in a text editor and swap the back-end by changing the "backend": flag from 'tensorflow' to 'theano'. Save the json file that looks something like this: { "image_data_format": "channels_last", "epsilon": 1e-07, "floatx": "float32", "backend": "theano, } Step 4: sudo pip3 install theano Step 5: Run the 02_Twitter_bot_LSTM.py file

Hard solution: Nuke the environment and perform a clean install of everything and try running the file afterwards --OR-- Create a shiny new virtualenv and run everything inside it.

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rahulremanan/python_tutorial/issues/3#issuecomment-323887976, or mute the thread https://github.com/notifications/unsubscribe-auth/AT4giOjAJZ5AeoYyL5Cok0rGUqL6_tEAks5saiShgaJpZM4O9dG8 .

― You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.