Cannot see Tensorflow logs in google colab notebook
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I was playing around with tensorflow apis on google colab virtual notebook. I want to see device mapping of my colab virtual machine.
As mentioned on tensorflow developer guide, I can set the flag (log_device_placement=True) to enable logging. https://www.tensorflow.org/guide/using_gpu
Below is my code running on colab notebook -
import tensorflow as tf
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
tf.logging.set_verbosity(tf.logging.INFO)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print(sess.run(c))
But it doesn't seems to work on colab notebook. However it is working with local jupyter notebook terminal console.
Any idea how to enable logging on google colab platform ?
python tensorflow google-colaboratory
add a comment |
I was playing around with tensorflow apis on google colab virtual notebook. I want to see device mapping of my colab virtual machine.
As mentioned on tensorflow developer guide, I can set the flag (log_device_placement=True) to enable logging. https://www.tensorflow.org/guide/using_gpu
Below is my code running on colab notebook -
import tensorflow as tf
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
tf.logging.set_verbosity(tf.logging.INFO)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print(sess.run(c))
But it doesn't seems to work on colab notebook. However it is working with local jupyter notebook terminal console.
Any idea how to enable logging on google colab platform ?
python tensorflow google-colaboratory
add a comment |
I was playing around with tensorflow apis on google colab virtual notebook. I want to see device mapping of my colab virtual machine.
As mentioned on tensorflow developer guide, I can set the flag (log_device_placement=True) to enable logging. https://www.tensorflow.org/guide/using_gpu
Below is my code running on colab notebook -
import tensorflow as tf
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
tf.logging.set_verbosity(tf.logging.INFO)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print(sess.run(c))
But it doesn't seems to work on colab notebook. However it is working with local jupyter notebook terminal console.
Any idea how to enable logging on google colab platform ?
python tensorflow google-colaboratory
I was playing around with tensorflow apis on google colab virtual notebook. I want to see device mapping of my colab virtual machine.
As mentioned on tensorflow developer guide, I can set the flag (log_device_placement=True) to enable logging. https://www.tensorflow.org/guide/using_gpu
Below is my code running on colab notebook -
import tensorflow as tf
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
tf.logging.set_verbosity(tf.logging.INFO)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print(sess.run(c))
But it doesn't seems to work on colab notebook. However it is working with local jupyter notebook terminal console.
Any idea how to enable logging on google colab platform ?
python tensorflow google-colaboratory
python tensorflow google-colaboratory
asked Nov 17 '18 at 4:35
shubham goelshubham goel
286
286
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Looks like a TensorFlow issue: https://github.com/tensorflow/tensorflow/issues/3047
Or, a jupyter issue: https://github.com/ipython/ipython/issues/1230
Here's a work-around using a third-party library:
!pip install wurlitzer
import tensorflow as tf
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
tf.logging.set_verbosity(tf.logging.INFO)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
from wurlitzer import pipes
with pipes() as (out, err):
print(sess.run(c))
print (out.read())
Full notebook:
https://colab.research.google.com/drive/1Z5FVCD_z8EMmyd31PsjQffQV_K7dDLfj
Thanks @bob-smith , wurlitzer works like a charm. I have one more query. Even though I selected TPU as a runtime in colab, TF session jobs are still running on CPU as per the logs. What extra config parameter should I pass to tf session to make it run these jobs on TPU ?
– shubham goel
Nov 18 '18 at 6:57
Please use distinct questions for distinct issues. Thanks!
– Bob Smith
Nov 18 '18 at 16:33
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53348251%2fcannot-see-tensorflow-logs-in-google-colab-notebook%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Looks like a TensorFlow issue: https://github.com/tensorflow/tensorflow/issues/3047
Or, a jupyter issue: https://github.com/ipython/ipython/issues/1230
Here's a work-around using a third-party library:
!pip install wurlitzer
import tensorflow as tf
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
tf.logging.set_verbosity(tf.logging.INFO)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
from wurlitzer import pipes
with pipes() as (out, err):
print(sess.run(c))
print (out.read())
Full notebook:
https://colab.research.google.com/drive/1Z5FVCD_z8EMmyd31PsjQffQV_K7dDLfj
Thanks @bob-smith , wurlitzer works like a charm. I have one more query. Even though I selected TPU as a runtime in colab, TF session jobs are still running on CPU as per the logs. What extra config parameter should I pass to tf session to make it run these jobs on TPU ?
– shubham goel
Nov 18 '18 at 6:57
Please use distinct questions for distinct issues. Thanks!
– Bob Smith
Nov 18 '18 at 16:33
add a comment |
Looks like a TensorFlow issue: https://github.com/tensorflow/tensorflow/issues/3047
Or, a jupyter issue: https://github.com/ipython/ipython/issues/1230
Here's a work-around using a third-party library:
!pip install wurlitzer
import tensorflow as tf
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
tf.logging.set_verbosity(tf.logging.INFO)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
from wurlitzer import pipes
with pipes() as (out, err):
print(sess.run(c))
print (out.read())
Full notebook:
https://colab.research.google.com/drive/1Z5FVCD_z8EMmyd31PsjQffQV_K7dDLfj
Thanks @bob-smith , wurlitzer works like a charm. I have one more query. Even though I selected TPU as a runtime in colab, TF session jobs are still running on CPU as per the logs. What extra config parameter should I pass to tf session to make it run these jobs on TPU ?
– shubham goel
Nov 18 '18 at 6:57
Please use distinct questions for distinct issues. Thanks!
– Bob Smith
Nov 18 '18 at 16:33
add a comment |
Looks like a TensorFlow issue: https://github.com/tensorflow/tensorflow/issues/3047
Or, a jupyter issue: https://github.com/ipython/ipython/issues/1230
Here's a work-around using a third-party library:
!pip install wurlitzer
import tensorflow as tf
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
tf.logging.set_verbosity(tf.logging.INFO)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
from wurlitzer import pipes
with pipes() as (out, err):
print(sess.run(c))
print (out.read())
Full notebook:
https://colab.research.google.com/drive/1Z5FVCD_z8EMmyd31PsjQffQV_K7dDLfj
Looks like a TensorFlow issue: https://github.com/tensorflow/tensorflow/issues/3047
Or, a jupyter issue: https://github.com/ipython/ipython/issues/1230
Here's a work-around using a third-party library:
!pip install wurlitzer
import tensorflow as tf
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
tf.logging.set_verbosity(tf.logging.INFO)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
from wurlitzer import pipes
with pipes() as (out, err):
print(sess.run(c))
print (out.read())
Full notebook:
https://colab.research.google.com/drive/1Z5FVCD_z8EMmyd31PsjQffQV_K7dDLfj
answered Nov 17 '18 at 17:46
Bob SmithBob Smith
9,48942836
9,48942836
Thanks @bob-smith , wurlitzer works like a charm. I have one more query. Even though I selected TPU as a runtime in colab, TF session jobs are still running on CPU as per the logs. What extra config parameter should I pass to tf session to make it run these jobs on TPU ?
– shubham goel
Nov 18 '18 at 6:57
Please use distinct questions for distinct issues. Thanks!
– Bob Smith
Nov 18 '18 at 16:33
add a comment |
Thanks @bob-smith , wurlitzer works like a charm. I have one more query. Even though I selected TPU as a runtime in colab, TF session jobs are still running on CPU as per the logs. What extra config parameter should I pass to tf session to make it run these jobs on TPU ?
– shubham goel
Nov 18 '18 at 6:57
Please use distinct questions for distinct issues. Thanks!
– Bob Smith
Nov 18 '18 at 16:33
Thanks @bob-smith , wurlitzer works like a charm. I have one more query. Even though I selected TPU as a runtime in colab, TF session jobs are still running on CPU as per the logs. What extra config parameter should I pass to tf session to make it run these jobs on TPU ?
– shubham goel
Nov 18 '18 at 6:57
Thanks @bob-smith , wurlitzer works like a charm. I have one more query. Even though I selected TPU as a runtime in colab, TF session jobs are still running on CPU as per the logs. What extra config parameter should I pass to tf session to make it run these jobs on TPU ?
– shubham goel
Nov 18 '18 at 6:57
Please use distinct questions for distinct issues. Thanks!
– Bob Smith
Nov 18 '18 at 16:33
Please use distinct questions for distinct issues. Thanks!
– Bob Smith
Nov 18 '18 at 16:33
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53348251%2fcannot-see-tensorflow-logs-in-google-colab-notebook%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown