SimCLR icon indicating copy to clipboard operation
SimCLR copied to clipboard

Maybe a small bug in LARS implementation

Open Big-Brother-Pikachu opened this issue 4 years ago • 0 comments

Hello, thanks for your pretty implementation. I think I may find a small bug in your LARS implementation.trust_ratio = tf.where( tf.greater(w_norm, 0), tf.where( tf.greater(g_norm, 0), (self.eeta * w_norm / g_norm), 1.0), 1.0) is a little different from https://github.com/Spijkervet/SimCLR/blob/654f05f107ce17c0a9db385f298a2dc6f8b3b870/modules/lars.py#L119-L127 As greater is > and ge is >=. Thus bias paramater which is initialized as 0 is never updated. I think trust_ratio = torch.where( w_norm.gt(0), torch.where( g_norm.gt(0), (self.eeta * w_norm / g_norm), torch.Tensor([1.0]).to(device), ), torch.Tensor([1.0]).to(device), ).item() may work better.

Big-Brother-Pikachu avatar Jan 18 '21 06:01 Big-Brother-Pikachu