Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update tf2_image_retraining.ipynb #2339

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

Open
guidoiaquinti wants to merge 1 commit into tensorflow:master
base: master
Choose a base branch
Loading
from guidoiaquinti:master

Conversation

Copy link

@guidoiaquinti guidoiaquinti commented Nov 10, 2024

Hi 👋

While working through the tutorials, I ran into an hiccup with tf2_image_retraining.ipynb:

/usr/local/lib/python3.10/dist-packages/keras/src/layers/core/input_layer.py:26: UserWarning: Argument `input_shape` is deprecated. Use `shape` instead.
 warnings.warn(
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
[<ipython-input-3-4ec403fe43da>](https://localhost:8080/#) in <cell line: 170>()
 168 
 169 print("Building model with", model_handle)
--> 170 model = tf.keras.Sequential([
 171 # Explicitly define the input shape so the model can be properly
 172 # loaded by the TFLiteConverter
1 frames
[/usr/local/lib/python3.10/dist-packages/keras/src/models/sequential.py](https://localhost:8080/#) in __init__(self, layers, trainable, name)
 71 if layers:
 72 for layer in layers:
---> 73 self.add(layer, rebuild=False)
 74 self._maybe_rebuild()
 75 
[/usr/local/lib/python3.10/dist-packages/keras/src/models/sequential.py](https://localhost:8080/#) in add(self, layer, rebuild)
 93 layer = origin_layer
 94 if not isinstance(layer, Layer):
---> 95 raise ValueError(
 96 "Only instances of `keras.Layer` can be "
 97 f"added to a Sequential model. Received: {layer} "
ValueError: Only instances of `keras.Layer` can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x7823dd59b7f0> (of type <class 'tensorflow_hub.keras_layer.KerasLayer'>)

The code change fixes the ValueError, as well as the deprecation warning.

Thanks for all the amazing work on these tutorials! 😊

Copy link

Preview

Preview and run these notebook edits with Google Colab: Rendered notebook diffs available on ReviewNB.com.

Format and style

Use the TensorFlow docs notebook tools to format for consistent source diffs and lint for style:
$ python3 -m pip install -U --user git+https://github.com/tensorflow/docs

$ python3 -m tensorflow_docs.tools.nbfmt notebook.ipynb
$ python3 -m tensorflow_docs.tools.nblint --arg=repo:tensorflow/docs notebook.ipynb
If commits are added to the pull request, synchronize your local branch: git pull origin master

Copy link
Contributor

8bitmp3 commented Nov 11, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@MarkDaoust MarkDaoust Awaiting requested review from MarkDaoust

@markmcd markmcd Awaiting requested review from markmcd

At least 1 approving review is required to merge this pull request.

Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /