tensorflow / similarity

TensorFlow Similarity is a python package focused on making similarity learning quick and easy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compatibility with tensorflow 2.10

Lunatik00 opened this issue · comments

Hi, small but important bug, using tfsim v0.16.7 with tf v2.10 I can't save my model (only tried using efficientnet B0 as backbone when doing unsupervised learning), but it works with tf v2.9

  File "/usr/lib/python3.9/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.9/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
TypeError: Unable to serialize [2.0896919 2.1128857 2.1081853] to JSON. Unrecognized type <class 'tensorflow.python.framework.ops.EagerTensor'>.

I don't think is the python version or the json encoder really, since it works well with tensorflow 2.9, probably there was some compatibility break with 2.10 so the max compatible version for tfsim v0.16.7 should be 2.9

Thanks for raising this, I'll take a look and see if I can repro the error on our side

@Lunatik00

This is a bug within the keras application efficientnet code.
There's a (not ideal) but workable fix that you can make here. It should let you save your model.