Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe a small bug in LARS implementation #27

Open
Big-Brother-Pikachu opened this issue Jan 18, 2021 · 0 comments
Open

Maybe a small bug in LARS implementation #27

Big-Brother-Pikachu opened this issue Jan 18, 2021 · 0 comments

Comments

@Big-Brother-Pikachu
Copy link

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

SimCLR/modules/lars.py

Lines 119 to 127 in 654f05f

trust_ratio = torch.where(
w_norm.ge(0),
torch.where(
g_norm.ge(0),
(self.eeta * w_norm / g_norm),
torch.Tensor([1.0]).to(device),
),
torch.Tensor([1.0]).to(device),
).item()

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant