iterative / dvclive

📈 Log and track ML metrics, parameters, models with Git and/or DVC
https://dvc.org/doc/dvclive
Apache License 2.0
161 stars 35 forks source link

fix: Improve safety of logging images with implicit formats #744

Closed natikgadzhi closed 7 months ago

natikgadzhi commented 9 months ago

Summary

This pull request makes it so:

Closes #743

Changes

@dberenbaum, I felt that both approaches need to be implemented together. Inferring the format is nice, but only works in some situations and not others. So for a situation where the format could not be inferred, I added an additional check that will fail early and won't attempt saving the image.

My Python must be not optimal. The changes are split into two commits, feature-wise.

I'm not strongly attached to the could_log idea. In the end of the day, it's only saving us a bit of time, and clarifies the error, but it's not strictly required.

TODO

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

natikgadzhi commented 9 months ago

I wonder if that's worth documenting? Sort of a minor change, but happy to put a PR into the docs site, too.

natikgadzhi commented 9 months ago

Also, happy to write up the python docs in all the live.* functions if that's something that you think is useful.