GoogleCloudPlatform / cloudml-samples

Cloud ML Engine repo. Please visit the new Vertex AI samples repo at https://github.com/GoogleCloudPlatform/vertex-ai-samples
https://cloud.google.com/ai-platform/docs/
Apache License 2.0
1.52k stars 857 forks source link

Bug in Keras sample #191

Closed sebastianbk closed 6 years ago

sebastianbk commented 6 years ago

When using the preprocess.py tool to prepare a chunk of data for testing out the Cloud ML Engine prediction service (using the model trained with Keras and saved to a SavedModel file), an exception is thrown on line 25:

https://github.com/GoogleCloudPlatform/cloudml-samples/blob/8a349c10bc19c1fe42bd6bd83606cec3a23b8f76/census/keras/preprocess.py#L25

The tool uses the generator_input function in the model.py file, which returns a generator object. However, this object does not have a next() method, which is the preprocess.py tool assumes. Hence, the following exception is thrown:

Traceback (most recent call last):
  File "preprocess.py", line 25, in <module>
    sample = gen.next()
AttributeError: 'generator' object has no attribute 'next'

I have been trying to investigate whether an update was made to the model.py file breaking the functionality of the preprocess file. I am not sure but I believe this commit could be the reason: https://github.com/GoogleCloudPlatform/cloudml-samples/commit/494721f7ad7dc44d6e8da3ac287b5dc5c39fab59

I would try to fix this issue myself and submit a pull request but I am haven't been successful in finding a solution. Could you point me in the direction of the cause of the problem? Then I will attempt to resolve it.

puneith commented 6 years ago

@sebastianbk It is returning a generator and I confirmed by running the code it works. Can you confirm you don't have a file named model.py which doesn't have the function?

puneith commented 6 years ago

@sebastianbk closing this issue due to inactivity. Feel free to reopen or file new issue.