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

AttributeError: 'Model' object has no attribute 'internal_input_shapes' #51

Open
leovan opened this issue Jan 29, 2018 · 11 comments
Open

Comments

@leovan
Copy link

leovan commented Jan 29, 2018

I am using Python 3.6 and install keras_adversarial with the master branch, it seems that Model has no attribute 'internal_input_shapes' BUT '_internal_input_shapes'. Also Model has no attribute 'internal_output_shapes' either.

Traceback (most recent call last):
File "example_gan.py", line 118, in
main()
File "example_gan.py", line 114, in main
latent_dim=latent_dim)
File "example_gan.py", line 71, in example_gan
loss=loss)
File "/Users/leo/Applications/anaconda3/lib/python3.6/site-packages/keras_adversarial-0.0.3-py3.6.egg/keras_adversarial/adversarial_model.py", line 91, in adversarial_compile
AttributeError: 'Model' object has no attribute 'internal_input_shapes'

@leovan
Copy link
Author

leovan commented Jan 29, 2018

After I correct the 'internal_input_shapes' and 'internal_output_shapes' to '_internal_input_shapes' and '_internal_output_shapes', it still got errors with example_gan.py:

Traceback (most recent call last):
File "example_gan.py", line 118, in
main()
File "example_gan.py", line 114, in main
latent_dim=latent_dim)
File "example_gan.py", line 90, in example_gan
batch_size=32)
File "/Users/leo/Applications/anaconda3/lib/python3.6/site-packages/keras_adversarial-0.0.3-py3.6.egg/keras_adversarial/legacy.py", line 18, in fit
File "/Users/leo/Applications/anaconda3/lib/python3.6/site-packages/keras/engine/training.py", line 1593, in fit
batch_size=batch_size)
File "/Users/leo/Applications/anaconda3/lib/python3.6/site-packages/keras/engine/training.py", line 1426, in _standardize_user_data
exception_prefix='input')
File "/Users/leo/Applications/anaconda3/lib/python3.6/site-packages/keras/engine/training.py", line 110, in _standardize_input_data
'with shape ' + str(data_shape))
ValueError: Error when checking input: expected discriminator_flatten_input to have 2 dimensions, but got array with shape (60000, 28, 28)

I am using Python 3.6, Keras 2.1.3 and Tensorflow 1.5

@ilansc
Copy link

ilansc commented Feb 12, 2018

I also have the same problems

@riccardo-benedetti-unibo

I'm stuck in the same situation. Any update?

@kechan
Copy link

kechan commented Feb 26, 2018

I had the same error and on Keras 2.1.3, I tried downgrade keras to 2.1.2 and it works. So this maybe a temp solution.

@innovia
Copy link

innovia commented Feb 27, 2018

same with 2.1.4 only 2.1.2 works

@MitchProbst
Copy link

MitchProbst commented Feb 28, 2018

The first error appears to have happened because of a change in Keras, internal_input_shapes and internal_output_shapes were changed to be private variables in the keras/engine/topology.py file, reference this commit

As far as a fix for the second error goes, I'm still not sure. But the example_gan.py file is running a legacy version of fit, and I'm not sure what ought to be done to fix it.

@mohbattharani
Copy link

I have same problem with Keras 2.1.3 on one machine but works fine with Keras 2.1.2 on other machine. I might need to downgrade 2.1.3 to 2.1.2.

@adibyte95
Copy link

my keras version was 2.1.6 and i was getting the same error.... downgrading solved the issue

@csapot
Copy link

csapot commented Sep 24, 2018

do you have any suggestions about how to use the keras-adversarial examples without downgrading the keras, i.e. with newer versions?

@SarahMue
Copy link

with newer keras versions try K.int_shape(model.inputs[0])

@Ritaprava95
Copy link

with newer keras versions try K.int_shape(model.inputs[0])

Where to use this?

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