-
Notifications
You must be signed in to change notification settings - Fork 37
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
Live.log_artifact
raises ValueError
by logging to closed stderr
when Tensorflow is imported first
#763
Comments
Just want to confirm how severe it is for you. It sounds like you can work around the problem and are reporting more to let us know. Is that right? |
That's right - importing |
I'm not able to reproduce this so far. If I try with the code you showed and no |
I didn't mention in the OP, but I've only encountered the error in notebooks. I'm able to reproduce it consistently in Colab: https://colab.research.google.com/drive/1aEkYJdQ6cYiu2ICFppg8WrJwr0y6-SG4?usp=sharing In this case, I get the warning because there are no commits, which triggers the Thanks for looking into it! |
Looks like it may be related to iterative/dvc#8387 |
Confirmed that dropping this line fixes the issue: https://github.com/iterative/dvc/blob/b46bd9ca654f5e2dbeeb31f4eb6acaf80a7fde0a/dvc/logger.py#L182 @skshetry Looks like you were testing this in iterative/dvc#8985. Do you have any idea what's wrong or how to handle it? |
I'm running into a strange bug whenever
Live.log_artifact
tries to raise a warning or error withtensorflow
imported. It should be reproducible below (tensorflow==2.13.0
,dvc==3.38.1
, anddvclive==3.5.1
) as long as you have uncommitted changes in the repo (or some other way to raise a warning/error, like a missing artifact path).raises
Full traceback
From what I can tell from the traceback, DVC tries to raise a warning for uncommited changes, which gets logged to the closed
stderr
stream, causing the I/O error. The same error will occur for other errors or warnings raised bydvclive
as well. I found a few hints that might help diagnose the issue below, but I think I've reached the limit of what I'm able to figure out.tensorflow
is imported beforedvclive
. When the order is reversed,sys.stderr
remains open and no error is encountered.sys.stderr
getting closed during testing.sys.stderr
, it becomes closed as soon asgto
is imported bylog_artifact
. Disabling that import and the related calls resolves the issue. Looking at the init for thegto.log
module shows that it's setting some logging config.dvclive/src/dvclive/live.py
Lines 498 to 499 in 5c650ef
It's possible this is ultimately a Tensorflow/Keras issue rather than a DVC issue, but I'm not sure how to reproduce it without DVC.
Any help would be appreciated, thanks!
The text was updated successfully, but these errors were encountered: