Open qimingj opened 7 years ago
I think one downside to a 'import google.datalab.capture_stdout as cs' is that this package has to be listed as a dependency in setup.py in user's code or added to --packages for training on ml engine...if the user expects the same code to work there.
Because we own the container, could this be solved by some set of jupyter configs? Maybe jupyter can look at some log and print anything that came from a tensorflow file?
My terminal shows:
{"name":"app","hostname":"7c78925abbd4","pid":96,"type":"jupyter","level":30,"msg":"[9000]: I tensorflow/core/kernels/logging_ops.cc:79] hi[1]\n","time":"2017-03-16T18:15:58.840Z" ,"v":0}
from tf.print doc:
"Note: This op prints to the standard error. It is not currently compatible with jupyter notebook (printing to the notebook server's output, not into the notebook)."
https://www.tensorflow.org/api_docs/python/tf/Print
I think we should wait for a fix from tf.
Currently tf.Print prints stuff in c stdout, which is not reflected in sys.stdout. Users have to apply workarounds like http://stackoverflow.com/questions/37898478/is-there-a-way-to-get-tensorflow-tf-print-output-to-appear-in-jupyter-notebook-o. to get tf.Print stuff showing up.
One proposal is for Datalab to provide a context, such that tf.Print works if we write code like:
import tensorflow as tf import google.datalab.capture_stdout as cs:
with cs.Capture(): with tf.Graph().as_default():
Create a few example ops