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

Issues with Keras 2.1.5 #56

Open
artusi-a opened this issue Apr 20, 2018 · 4 comments
Open

Issues with Keras 2.1.5 #56

artusi-a opened this issue Apr 20, 2018 · 4 comments

Comments

@artusi-a
Copy link

It seems that there are some issues with the latest version of Keras 2.1.5

  1. in adversial_model internal_input_shapes and internal_output_shapes need to be corrected to _internal_input_shapes, _internal_output_shapes, this is easy to fix.

  2. However the following error needs some more careful attention
    File "/Users/MacBookPro1/Work/Code/Python/PycharmProjects/GANs/venv/lib/python3.6/site-packages/keras/engine/training.py", line 1132, in _fit_loop
    stateful_metrics=self.stateful_metric_names)]
    AttributeError: 'AdversarialModel' object has no attribute 'stateful_metric_names'

Any help? is this going to be fixed? Thanks

@KinWaiCheuk
Copy link

KinWaiCheuk commented Jun 1, 2018

For your question 2, I have a quick fix, but not sure if it works for you.

In the adversarial_model.py, there is a block of code that fixes keras 2's compatibility issue, at around line 128.

        # Keras-2
        self._feed_loss_fns = self.loss_functions
        self._feed_inputs = self.inputs
        self._feed_input_names = self.input_names
        self._feed_input_shapes = self._feed_input_shapes
        self._feed_outputs = self.outputs
        self._feed_output_names = self.output_names
        self._feed_output_shapes = self._feed_output_shapes
        self._feed_sample_weights = self.sample_weights
        self._feed_sample_weight_modes = self.sample_weight_modes

Try adding the following codes to the block.

        self._feed_targets = self.targets
        self.metrics = model.metrics_tensors
        self.stateful_metric_names = self.metrics_names

@artusi-a
Copy link
Author

artusi-a commented Jun 1, 2018

Ok I will do and let you know if it works. Thanks a lot

@Zooshi
Copy link

Zooshi commented Jun 2, 2018

I do not see the codeblock in the adversarial_model.py file

@KinWaiCheuk
Copy link

KinWaiCheuk commented Jun 3, 2018

Then your adversarial_model.py is not up-to-date. Download the latest version, and you will see the following code block.
codebloack

Then replace the code with the following:

        # Keras-2
        self._feed_loss_fns = self.loss_functions
        self._feed_inputs = self.inputs
        self._feed_input_names = self.input_names
        self._feed_input_shapes = self._feed_input_shapes #error fix
        self._feed_outputs = self.outputs
        self._feed_output_names = self.output_names
        self._feed_output_shapes = self._feed_output_shapes #error fix
        self._feed_sample_weights = self.sample_weights
        self._feed_sample_weight_modes = self.sample_weight_modes

        self._feed_targets = self.targets
        self.metrics = model.metrics_tensors
        self.stateful_metric_names = self.metrics_names

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

3 participants