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

grads become zeros after a short period of training on metal backend #860

Open
michael8090 opened this issue Mar 25, 2024 · 0 comments
Open

Comments

@michael8090
Copy link

code: https://github.com/michael8090/test-candle-metal/tree/tch-rs-grads

At line 123:

        // ISSUE HERE: use the line below with metal to see zero gradients...
        let mut pred_loss = Tensor::zeros(&[1], (Kind::Float, device));
        // With the line below, the issue goes away
        // let mut pred_loss;

When the variable is inited with a Tensor, the grads becomes zeros after about 5 iteration. But when I leave it uninitialized at the first place, the issue goes away.

When you run the code, it'll print about 40 times and you can see how the grads change.

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