tensorflow / similarity

TensorFlow Similarity is a python package focused on making similarity learning quick and easy.
Apache License 2.0
1.01k stars 104 forks source link

Self-Supervised Learning tutorial fails with latest TensorFlow Similarity #272

Closed labroskokkalas closed 2 years ago

labroskokkalas commented 2 years ago

Self-Supervised Learning tutorial fails in contrastive_model training with

File "C:\Users\lone_\AppData\Local\Continuum\anaconda3\envs\tf28-gpu\lib\site-packages\keras\engine\training.py", line 1021, in train_function  *
    return step_function(self, iterator)
File "C:\Users\lone_\AppData\Local\Continuum\anaconda3\envs\tf28-gpu\lib\site-packages\tensorflow_similarity\losses\simsiam.py", line 111, in call  *
    loss: FloatTensor = (

TypeError: Missing required positional argument

Google Colab also fails.

It is a typo
loss: FloatTensor = ( tf.math.multiply(per_example_projection * 0.5) + self.margin ) should change to

loss: FloatTensor = ( tf.math.multiply(per_example_projection, 0.5) + self.margin )

owenvallis commented 2 years ago

Thanks for issue. I'll push a fix shortly.