Skip to content

Instantly share code, notes, and snippets.

@ageron
Created December 30, 2018 16:11
Show Gist options
  • Save ageron/1d430d4a7716c7a2bae44ee82c321f01 to your computer and use it in GitHub Desktop.
Save ageron/1d430d4a7716c7a2bae44ee82c321f01 to your computer and use it in GitHub Desktop.
Python session for TensorFlow issue 24632
(tf2) ageron@macmix:~/dev/py/ml/kiwisoft_courses/dl_course$ python
Python 3.6.6 (default, Jun 28 2018, 05:43:53)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> import numpy as np
>>> import tensorflow as tf
>>> from tensorflow import keras
>>>
>>> X_train = np.random.rand(1000, 10)
>>> y_train = np.random.rand(1000)
>>> model = keras.models.Sequential([keras.layers.Dense(1)])
>>> model.compile(loss="mse", optimizer="sgd")
>>> tensorboard_cb = keras.callbacks.TensorBoard("logs/run1")
>>> model.fit(X_train, y_train, epochs=1000, callbacks=[tensorboard_cb])
2018-12-31 00:07:54.624189: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
WARNING:tensorflow:From /Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py:651: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From /Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/utils/losses_utils.py:170: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
WARNING:tensorflow:From /Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:3067: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
Epoch 1/1000
1000/1000 [==============================] - 0s 89us/sample - loss: 2.1433
Epoch 2/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 1.4175
Epoch 3/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.9602
Epoch 4/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.6713
Epoch 5/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.4880
Epoch 6/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.3722
Epoch 7/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.2979
Epoch 8/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.2511
Epoch 9/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.2208
Epoch 10/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.2022
Epoch 11/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.1894
Epoch 12/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.1815
Epoch 13/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.1762
Epoch 14/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.1722
Epoch 15/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.1695
Epoch 16/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.1673
Epoch 17/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.1657
Epoch 18/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.1643
Epoch 19/1000
1000/1000 [==============================] - 0s 21us/sample - loss: 0.1631
Epoch 20/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.1622
Epoch 21/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.1613
Epoch 22/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.1604
Epoch 23/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.1595
Epoch 24/1000
32/1000 [..............................] - ETA: 0s - loss: 0.1498^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 907, in fit
validation_steps=validation_steps)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 334, in model_iteration
batch_outs = f(ins_batch)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 3167, in __call__
outputs = self._graph_fn(*converted_inputs)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 369, in __call__
return self._call_flat(args)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 434, in _call_flat
outputs = self._inference_function.call(ctx, args)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 270, in call
executor_type=function_call_options.executor_type)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/functional_ops.py", line 1083, in partitioned_call
executor_type=executor_type)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/gen_functional_ops.py", line 483, in stateful_partitioned_call
"executor_type", executor_type)
KeyboardInterrupt
>>> model.fit(X_train, y_train, epochs=1000, callbacks=[tensorboard_cb])
Epoch 1/1000
32/1000 [..............................] - ETA: 0s - loss: 0.20302018-12-31 00:07:59.679517: W tensorflow/core/framework/op_kernel.cc:1408] OP_REQUIRES failed at summary_kernels.cc:175 : Not found: Resource localhost/logdir:logs/run1/N10tensorflow22SummaryWriterInterfaceE does not exist.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 907, in fit
validation_steps=validation_steps)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 377, in model_iteration
callbacks.on_epoch_end(epoch, epoch_logs)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/callbacks.py", line 269, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/callbacks.py", line 1394, in on_epoch_end
self._write_custom_summaries(step, logs)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/callbacks.py", line 1341, in _write_custom_summaries
summary_ops_v2.scalar(name, value, step=step)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/summary_ops_v2.py", line 564, in scalar
return summary_writer_function(name, tensor, function, family=family)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/summary_ops_v2.py", line 508, in summary_writer_function
should_record_summaries(), record, _nothing, name="")
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/framework/smart_cond.py", line 54, in smart_cond
return true_fn()
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/summary_ops_v2.py", line 501, in record
with ops.control_dependencies([function(tag, scope)]):
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/summary_ops_v2.py", line 562, in function
name=scope)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/gen_summary_ops.py", line 675, in write_scalar_summary
writer, step, tag, value, name=name, ctx=_ctx)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/gen_summary_ops.py", line 706, in write_scalar_summary_eager_fallback
attrs=_attrs, ctx=_ctx, name=name)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/eager/execute.py", line 66, in quick_execute
six.raise_from(core._status_to_exception(e.code, message), None)
File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.NotFoundError: Resource localhost/logdir:logs/run1/N10tensorflow22SummaryWriterInterfaceE does not exist. [Op:WriteScalarSummary] name: epoch_loss/
>>> shutil.rmtree("logs")
>>> model = keras.models.Sequential([keras.layers.Dense(1)])
>>> model.compile(loss="mse", optimizer="sgd")
>>> tensorboard_cb = keras.callbacks.TensorBoard("logs/run1")
>>> model.fit(X_train, y_train, epochs=1000, callbacks=[tensorboard_cb])
Epoch 1/1000
1000/1000 [==============================] - 0s 101us/sample - loss: 0.4551
Epoch 2/1000
1000/1000 [==============================] - 0s 25us/sample - loss: 0.3882
Epoch 3/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.3459
Epoch 4/1000
1000/1000 [==============================] - 0s 25us/sample - loss: 0.3192
Epoch 5/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.3010
Epoch 6/1000
1000/1000 [==============================] - 0s 26us/sample - loss: 0.2889
Epoch 7/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.2804
Epoch 8/1000
1000/1000 [==============================] - 0s 26us/sample - loss: 0.2745
Epoch 9/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.2702
Epoch 10/1000
1000/1000 [==============================] - 0s 25us/sample - loss: 0.2669
Epoch 11/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.2643
Epoch 12/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.2620
Epoch 13/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.2599
Epoch 14/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.2579
Epoch 15/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.2561
Epoch 16/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.2544
Epoch 17/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.2526
Epoch 18/1000
1000/1000 [==============================] - 0s 25us/sample - loss: 0.2509
Epoch 19/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.2493
Epoch 20/1000
1000/1000 [==============================] - 0s 26us/sample - loss: 0.2477
Epoch 21/1000
1000/1000 [==============================] - 0s 27us/sample - loss: 0.2461
Epoch 22/1000
1000/1000 [==============================] - 0s 27us/sample - loss: 0.2445
Epoch 23/1000
1000/1000 [==============================] - 0s 25us/sample - loss: 0.2430
Epoch 24/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.2414
Epoch 25/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.2399
Epoch 26/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.2383
Epoch 27/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.2368
Epoch 28/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.2354
Epoch 29/1000
1000/1000 [==============================] - 0s 22us/sample - loss: 0.2339
Epoch 30/1000
1000/1000 [==============================] - 0s 24us/sample - loss: 0.2325
Epoch 31/1000
1000/1000 [==============================] - 0s 23us/sample - loss: 0.2311
Epoch 32/1000
32/1000 [..............................] - ETA: 0s - loss: 0.2609^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 907, in fit
validation_steps=validation_steps)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 330, in model_iteration
callbacks._call_batch_hook(mode, 'begin', batch_index, batch_logs)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/callbacks.py", line 209, in _call_batch_hook
delta_t_median = np.median(self._delta_ts[hook_name])
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/numpy/lib/function_base.py", line 3336, in median
overwrite_input=overwrite_input)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/numpy/lib/function_base.py", line 3250, in _ureduce
r = func(a, **kwargs)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/numpy/lib/function_base.py", line 3389, in _median
rout = mean(part[indexer], axis=axis, out=out)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 2920, in mean
out=out, **kwargs)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/numpy/core/_methods.py", line 75, in _mean
ret = umr_sum(arr, axis, dtype, out, keepdims)
KeyboardInterrupt
>>> shutil.rmtree("logs")
>>> model = keras.models.Sequential([keras.layers.Dense(1)])
>>> model.compile(loss="mse", optimizer="sgd")
>>> tensorboard_cb = keras.callbacks.TensorBoard("logs/run1")
>>> model.fit(X_train, y_train, epochs=1000, callbacks=[tensorboard_cb])
Epoch 1/1000
32/1000 [..............................] - ETA: 2s - loss: 0.59702018-12-31 00:08:16.669571: W tensorflow/core/framework/op_kernel.cc:1408] OP_REQUIRES failed at summary_kernels.cc:105 : Unknown: The events file logs/run1/events.out.tfevents.1546186094.macmix.local.v2 has disappeared.
Failed to flush 1 events to logs/run1/events.out.tfevents.1546186094.macmix.local.v2
Could not flush events file.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 907, in fit
validation_steps=validation_steps)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 377, in model_iteration
callbacks.on_epoch_end(epoch, epoch_logs)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/callbacks.py", line 269, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/callbacks.py", line 1394, in on_epoch_end
self._write_custom_summaries(step, logs)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/callbacks.py", line 1341, in _write_custom_summaries
summary_ops_v2.scalar(name, value, step=step)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line 88, in __exit__
next(self.gen)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/summary_ops_v2.py", line 170, in as_default
gen_summary_ops.flush_summary_writer(self._resource)
File "/Users/ageron/.virtualenvs/tf2/lib/python3.6/site-packages/tensorflow/python/ops/gen_summary_ops.py", line 240, in flush_summary_writer
_six.raise_from(_core._status_to_exception(e.code, message), None)
File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.UnknownError: The events file logs/run1/events.out.tfevents.1546186094.macmix.local.v2 has disappeared.
Failed to flush 1 events to logs/run1/events.out.tfevents.1546186094.macmix.local.v2
Could not flush events file. [Op:FlushSummaryWriter]
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment