docs icon indicating copy to clipboard operation
docs copied to clipboard

Fix Text classification with TensorFlow Hub

Open dnoliver opened this issue 1 year ago • 4 comments

  • install tf_keras
  • use tf_keras model and layers

Run into a problem while running the cell:

Only instances of keras.Layer can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer

Applied the fix described in https://github.com/tensorflow/tensorflow/issues/63849. After the change, the notebook works end to end. But I think this actually downgrades the tf_keras support from 3 to 2, as noted in https://github.com/tensorflow/tensorflow/issues/63849#issuecomment-2011748852.

If the notebook is supposed to work as is, without this fix applied, then this PR shows how to apply the workaround to the notebook until the main issue is figured out :)

dnoliver avatar Sep 04 '24 21:09 dnoliver

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

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Sep 04 '24 21:09 google-cla[bot]

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 tf-hub-fix

github-actions[bot] avatar Sep 04 '24 21:09 github-actions[bot]

Thank you @dnoliver . Please review the CLA .

@MarkDaoust @markmcd keras. instead of tf_keras. or both in layer names?

8bitmp3 avatar Oct 03 '24 19:10 8bitmp3

Marking this pull request as stale since it has been open for 14 days with no activity. This PR will be closed if no further activity occurs.

github-actions[bot] avatar Oct 18 '24 02:10 github-actions[bot]

This pull request was closed because it has been inactive for 28 days. Please open a new pull request if you need further assistance. Thanks!

github-actions[bot] avatar Nov 01 '24 02:11 github-actions[bot]