notebooks icon indicating copy to clipboard operation
notebooks copied to clipboard

Resolve Libraries Conflict in chapter3/section3_tf.ipynb

Open peymanvahidi opened this issue 1 year ago • 1 comments
trafficstars

As documented in Issue #19262 on the Keras GitHub repository, there was a conflict between the Transformers and Keras libraries. Specifically, executing the following code resulted in an error associated with the Adam optimizer:

import tensorflow as tf

model = TFAutoModelForSequenceClassification.from_pretrained('checkpoint', num_labels=2)
loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
model.compile(optimizer='opt', loss=loss, metrics=["accuracy"])

I have updated the notebook to resolve this issue. With the modifications applied, the error no longer occurs, ensuring compatibility between the two libraries.

peymanvahidi avatar May 25 '24 19:05 peymanvahidi

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB