Skip to content

Conversation

@yoshikisd
Copy link
Collaborator

@yoshikisd yoshikisd commented Jun 12, 2025

In issue #33, an exception was raised when an SGD optimizer (coupled with a high learning rate) was used to perform reconstructions on a fancy_ptycho.py example. However, the error message does not clearly describe that the root cause of the problem may likely be related to excessively large gradients as pointed out in #33 (comment).

This PR aims to improve the readability of this error message.

@yoshikisd yoshikisd linked an issue Jun 12, 2025 that may be closed by this pull request
@gnzng
Copy link
Collaborator

gnzng commented Jun 12, 2025

Another common cause for nan values in the loss are related to the chosen loss functions and their normalization (divide by 0, neg log). So maybe it makes sense to raise that error more upstream when a nan loss is returned by the loss function checked by t.isnan(), instead of try.

@allevitan
Copy link
Collaborator

I think this is too general of a catch. Let me propose something else when I get a moment

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

Successfully merging this pull request may close these issues.

SGD optimizer does not work for the fancy_ptycho.py example

3 participants