Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError when running #7

Closed
BasharAG opened this issue Mar 14, 2017 · 7 comments
Closed

TypeError when running #7

BasharAG opened this issue Mar 14, 2017 · 7 comments

Comments

@BasharAG
Copy link

I tried running the code and installing dependencies using pip and pip3 and I tried running the code using python and python3, but I keep getting this:

Using TensorFlow backend.
> Loading data...
> Data Loaded. Compiling...
Traceback (most recent call last):
  File "run.py", line 36, in <module>
    model = lstm.build_model([1, 50, 100, 1])
  File "/root/LSTM/lstm.py", line 53, in build_model
    return_sequences=True))
  File "/usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/keras/layers/recurrent.py", line 931, in __init__
    super(LSTM, self).__init__(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/keras/layers/recurrent.py", line 181, in __init__
    super(Recurrent, self).__init__(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 275, in __init__
    raise TypeError('Keyword argument not understood:', kwarg)
TypeError: ('Keyword argument not understood:', 'input_dim')
@pusj
Copy link

pusj commented Mar 14, 2017

Hello Bashar,

It seems as if you are using Python 2.7, this code is written to be used with Python 3.5.

BR
Staffan

@BasharAG
Copy link
Author

BasharAG commented Mar 14, 2017 via email

@jaungiers
Copy link
Owner

Steffan does seem to be right from what I can see, despite you using pip3 it is using a python 2.7 runtime... if you type "python --version" into your console what do you get? If you get anything other than 3.5.x+ then that's your problem.

@BasharAG
Copy link
Author

My output for the python --version is Python 3.5.2
Still getting the following:

Using TensorFlow backend.
> Loading data...
> Data Loaded. Compiling...
Traceback (most recent call last):
  File "run.py", line 36, in <module>
    model = lstm.build_model([1, 50, 100, 1])
  File "/root/LSTM/lstm.py", line 53, in build_model
    return_sequences=True))
  File "/usr/local/lib/python3.5/dist-packages/keras/legacy/interfaces.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/keras/layers/recurrent.py", line 931, in __init__
    super(LSTM, self).__init__(**kwargs)
  File "/usr/local/lib/python3.5/dist-packages/keras/layers/recurrent.py", line 181, in __init__
    super(Recurrent, self).__init__(**kwargs)
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 275, in __init__
    raise TypeError('Keyword argument not understood:', kwarg)
TypeError: ('Keyword argument not understood:', 'input_dim')

@jaungiers
Copy link
Owner

Well then it looks like Keras is failing on something. All I can think of is that you're using a version of Keras that isn't the same as mine. Make sure you're using Keras 1.2.2 or if you want to use a different version then check the docs for your version's namespace arguments

@BasharAG
Copy link
Author

BasharAG commented Mar 14, 2017

Okay, so I re-installed keras, and the app ran for a while, but, I got the following error now:

Training duration (s) :  14.245285034179688
Traceback (most recent call last):
  File "run.py", line 50, in <module>
    plot_results_multiple(predictions, y_test, 50)
  File "run.py", line 14, in plot_results_multiple
    fig = plt.figure(facecolor='white')
  File "/usr/local/lib/python3.5/dist-packages/matplotlib/pyplot.py", line 535, in figure
    **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 81, in new_figure_manager
    return new_figure_manager_given_figure(num, figure)
  File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 89, in new_figure_manager_given_figure
    window = Tk.Tk()
  File "/usr/lib/python3.5/tkinter/__init__.py", line 1871, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
Exception ignored in: <bound method BaseSession.__del__ of <tensorflow.python.client.session.Session object at 0x7f032376f780>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 582, in __del__
AttributeError: 'NoneType' object has no attribute 'TF_DeleteStatus'

@BasharAG BasharAG reopened this Mar 14, 2017
@shaktisd
Copy link
Contributor

shaktisd commented Apr 14, 2017

Change line number 51 in lstm.py to make it work in keras 2.0
from input_dim=layers[0],
to input_shape=(layers[1], layers[0]),

Raised PR for the fix - #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants