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

Change model.fit to model.fit_generator #971

Closed
wants to merge 1 commit into from

Conversation

@eospi
Copy link

commented Sep 1, 2019

Running the current TensorFlow Hub with Keras (TF 2.0) tutorial fails when running model.fit with this error:

InvalidArgumentError: ValueError: `generator` yielded an element of shape (22, 224, 224, 3) where an element of shape (32, 224, 224, 3) was expected.
Traceback (most recent call last):

  File "/tensorflow-2.0.0-rc0/python3.6/tensorflow_core/python/ops/script_ops.py", line 221, in __call__
    ret = func(*args)

  File "/tensorflow-2.0.0-rc0/python3.6/tensorflow_core/python/data/ops/dataset_ops.py", line 621, in generator_py_func
    "of shape %s was expected." % (ret_array.shape, expected_shape))

ValueError: `generator` yielded an element of shape (22, 224, 224, 3) where an element of shape (32, 224, 224, 3) was expected.


	 [[{{node PyFunc}}]] [Op:IteratorGetNextSync]

The Colab notebook runs successfully using model.fit_generator instead.

@eospi eospi requested review from brilee, lamberta and MarkDaoust as code owners Sep 1, 2019

@tfdocsbot

This comment has been minimized.

Copy link
Collaborator

commented Sep 1, 2019

Preview and run these notebook edits with Google Colab:

Notebook diffs available on ReviewNB.com.
@googlebot

This comment has been minimized.

Copy link

commented Sep 1, 2019

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added the cla: no label Sep 1, 2019

@eospi

This comment has been minimized.

Copy link
Author

commented Sep 1, 2019

@googlebot I signed it!

@googlebot

This comment has been minimized.

Copy link

commented Sep 1, 2019

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels Sep 1, 2019

@aledalgrande

This comment has been minimized.

Copy link

commented Sep 9, 2019

Just ran into this as I'm learning Tensorflow. You should merge this and update your docs because that's what comes up in Web searches and it's very confusing and time consuming to work with TF2 when the instructions are wrong.

@lamberta
Copy link
Member

left a comment

Thanks. The docs in the repo have moved around a bit as we switch the site over to TF2-first, can you rebase and update this file instead? https://github.com/tensorflow/docs/blob/master/site/en/tutorials/images/transfer_learning_with_hub.ipynb

@lamberta lamberta added the invalid label Sep 9, 2019

@lamberta

This comment has been minimized.

Copy link
Member

commented Sep 9, 2019

Oh, looks like @MarkDaoust already fixed this in https://github.com/tensorflow/docs/blob/master/site/en/tutorials/images/transfer_learning_with_hub.ipynb
This will be updated on the site on the next publishing push.

@lamberta lamberta closed this Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.