-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Fix checkpoint warning for floats #2143
Comments
@justusschock @SkafteNicki mind have a look :] |
The reason it is still working is due to the fact that it is being converted to a
|
If types such as floats are supported, should they be excluded from the check and don't show warnings? And IMHO the warning message saying checkpoints won't be saved while they actually are is not desirable. |
sounds reasonable, mind draft a PR? 🐰 |
@ZhaofengWu Checking in :) |
Ah sorry I overlooked this. I might not have the time recently to do this. Sorry :( |
You can assign this to me :). |
Logging floats actually doesn't work with the current version. I tried logging a metric with different dtypes (tensor, float, int, dict, list) and it only works with tensors. See this colab. For the other types it fails even before reaching the
For example if in 2 validation steps the logged metric is I think this issue is connected with #3678 and #2636. Basically, shouldn't we ensure that the metrics that user logs fulfill some basic properties? Then later in the program we can assume that they are valid and avoid later extra checks like above in this issue:
|
then you need to make a tensor which has those attributes... :] |
Yeah :) Just found out this PR which could fix float logging when merged. |
Makes functions in `vak.transforms.distance.functional` return tensors so we don't cause errors when lightning tries to convert from numpy to tensors to log. Letting lightning do the conversion kind of works, but it can cause a fatal error for someone using an Apple M1 with 'mps' as the accelerator, see https://forum.vocalpy.org/t/vak-tweetynet-with-an-apple-m1-max/78/4?u=nicholdav I don't find any explicit statement in either the Lightning or Torchmetrics docs that metrics should always be tensors, and that this guarantees there won't be weird issues (right now we get a warning on start-up that all logged scalars should be float32, but I would expect one should be able to log integers too?). But from various issues I read, it seems like that should be the case, Lightning-AI/pytorch-lightning#2143 and I notice that torchmetrics classes tend to do things like convert to a float tensor
Makes functions in `vak.transforms.distance.functional` return tensors so we don't cause errors when lightning tries to convert from numpy to tensors to log. Letting lightning do the conversion kind of works, but it can cause a fatal error for someone using an Apple M1 with 'mps' as the accelerator, see https://forum.vocalpy.org/t/vak-tweetynet-with-an-apple-m1-max/78/4?u=nicholdav I don't find any explicit statement in either the Lightning or Torchmetrics docs that metrics should always be tensors, and that this guarantees there won't be weird issues (right now we get a warning on start-up that all logged scalars should be float32, but I would expect one should be able to log integers too?). But from various issues I read, it seems like that should be the case, Lightning-AI/pytorch-lightning#2143 and I notice that torchmetrics classes tend to do things like convert to a float tensor
Makes functions in `vak.transforms.distance.functional` return tensors so we don't cause errors when lightning tries to convert from numpy to tensors to log. Letting lightning do the conversion kind of works, but it can cause a fatal error for someone using an Apple M1 with 'mps' as the accelerator, see https://forum.vocalpy.org/t/vak-tweetynet-with-an-apple-m1-max/78/4?u=nicholdav I don't find any explicit statement in either the Lightning or Torchmetrics docs that metrics should always be tensors, and that this guarantees there won't be weird issues (right now we get a warning on start-up that all logged scalars should be float32, but I would expect one should be able to log integers too?). But from various issues I read, it seems like that should be the case, Lightning-AI/pytorch-lightning#2143 and I notice that torchmetrics classes tend to do things like convert to a float tensor
Makes functions in `vak.transforms.distance.functional` return tensors so we don't cause errors when lightning tries to convert from numpy to tensors to log. Letting lightning do the conversion kind of works, but it can cause a fatal error for someone using an Apple M1 with 'mps' as the accelerator, see https://forum.vocalpy.org/t/vak-tweetynet-with-an-apple-m1-max/78/4?u=nicholdav I don't find any explicit statement in either the Lightning or Torchmetrics docs that metrics should always be tensors, and that this guarantees there won't be weird issues (right now we get a warning on start-up that all logged scalars should be float32, but I would expect one should be able to log integers too?). But from various issues I read, it seems like that should be the case, Lightning-AI/pytorch-lightning#2143 and I notice that torchmetrics classes tend to do things like convert to a float tensor
#1819 added this warning when saving checkpoints. https://github.com/PyTorchLightning/pytorch-lightning/blob/bd49b07fbba09b1e7d8851ee5a1ffce3d5925e9e/pytorch_lightning/callbacks/model_checkpoint.py#L259-L263
The text was updated successfully, but these errors were encountered: