keras-team/tf-keras

Mirrored strategy model.load_weights() failure

Closed this issue · 2 comments

Describe the problem.

Calling model.load_weights fails with a TypeError when using MirroredStrategy scope.

Current Behavior:
load_weights raises "TypeError: unsupported operand type(s) for /: 'Dataset' and 'int'"

Expected Behavior:
load_weights succeeds

Note that this error does not occur when using OneDeviceStrategy and is fixed in Keras 3 (tested with tf-nightly).

Standalone code to reproduce the issue.

Google Colab link

I originally reported the issue against the tensorflow repo here. As the issue is fixed in Keras 3, fixing this supports those wishing to stay on Keras 2 through tf-keras with TF_USE_LEGACY_KERAS=1.

@SamKnightGit,
Thank you for the issue. We are checking this issue with the developer team. Could you please allow some time to provide the right resolution. Thank you!

@SamKnightGit,
I checked with the related team and it was confirmed that in the coming weeks the latest tensorflow 2.16.rc version will be released. As the issue was fixed in the nightly, for now we can utilize that. And also mentioned we can expect the tensorflow v2.16 in the coming month where the fix will be updated in that respective tensorflow version. Thank you!