Can't train the decoder of the perspective Transformer
System information
- What is the top-level directory of the model you are using: Ptn directory
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 14.04
- TensorFlow installed from (source or binary): Source
- TensorFlow version (use command below): ('v1.3.0-rc1-27-g2784b1c', '1.3.0-rc2')
- Bazel version (if compiling from source): 0.5.2
- CUDA/cuDNN version: 8.0/5.1
- GPU model and memory: Titan X
- Exact command to reproduce: run -c opt :train_ptn -- --init_model='/home/meeso/models/ptn/my_models/deeprotator_pretrain/train/' --checkpoint_dir='/home/meeso/models/ptn/my_models/' --inp_dir='/home/meeso/Datasets/shapenet_tf/
Describe the problem
When I try to run the command for training the volumetric decoder, it breaks after one iteration.
Source code / logs
`2017-08-08 17:45:24.214032: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1045] Creating TensorFlow device (/gpu:0) -> (device: 0, name: TITAN X (Pascal), pci bus id: 0000:02:00.0)
2017-08-08 17:45:24.214042: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1045] Creating TensorFlow device (/gpu:1) -> (device: 1, name: TITAN X (Pascal), pci bus id: 0000:03:00.0)
2017-08-08 17:45:24.214049: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1045] Creating TensorFlow device (/gpu:2) -> (device: 2, name: TITAN X (Pascal), pci bus id: 0000:81:00.0)
2017-08-08 17:45:24.214056: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1045] Creating TensorFlow device (/gpu:3) -> (device: 3, name: TITAN X (Pascal), pci bus id: 0000:82:00.0)
2017-08-08 17:45:40.764281: W tensorflow/core/framework/op_kernel.cc:1192] Unknown: exceptions.RuntimeError: main thread is not in main loop
Traceback (most recent call last):
File "/home/meeso/.cache/bazel/_bazel_meeso/3a6bfcc5e3fa6521c178dee287de79bc/execroot/main/bazel-out/local-opt/bin/train_ptn.runfiles/main/train_ptn.py", line 230, in
Caused by op u'PyFunc', defined at:
File "/home/meeso/.cache/bazel/_bazel_meeso/3a6bfcc5e3fa6521c178dee287de79bc/execroot/main/bazel-out/local-opt/bin/train_ptn.runfiles/main/train_ptn.py", line 230, in
UnknownError (see above for traceback): exceptions.RuntimeError: main thread is not in main loop [[Node: PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT64, DT_FLOAT, DT_FLOAT], Tout=[DT_UINT8], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/cpu:0"](mul_3, ResizeNearestNeighbor, ResizeNearestNeighbor_1, global_step/read, data_loading_shapenet_chair/val/batching_queues/shapenet_chair/val:1, decoder_1/Conv3d_transpose_2/Sigmoid/_4311)]] [[Node: PyFunc/_9028 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_32788_PyFunc", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/gpu:0"]]
Exception RuntimeError: RuntimeError('main thread is not in main loop',) in <bound method PhotoImage.del of <Tkinter.PhotoImage instance at 0x7f623863a170>> ignored Tcl_AsyncDelete: async handler deleted by the wrong thread`
@xcyan, it creates the image 0.jpg before breaking. I have all dependencies and don't know where the problem is.
Looking at the error message, this might be related: https://stackoverflow.com/questions/30816275/how-to-thread-matplotlib-in-python
You are running multigpu training with Tensorflow 1.3 under ubuntu. However, I think we haven't tested with this combination. @arkanath
Two solutions: (1) switch to tf1.2 or tf1.1 (2) turn off the visualization part by commenting out the write_disk_grid() and adding return None at the end. Commenting out matplotlib in Utils.py
I am not passing any arguments for multi-gpu, so that's not the issue. To make sure, I have just masked the GPUs, so that only one is visible for tensorflow with
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="1"
And I still get the same error.
Okey so I have found a solution. The code doesn't work with tf 1.2, because it relies of tf.contrib.slim.summaries that was introduced in 1.3, running the code with tf 1.2 gives you AttributeError: 'module' object has no attribute 'add_scalar_summary'. However, the core issue was the matplotlib multithreading. I fixed the issue by using the Agg backend. I will send a pull request. @xcyan @arkanath
Yes the readme states that you have to run the code with the latest tensorflow from source.
On Wed, Aug 9, 2017 at 11:56 PM, Oier Mees [email protected] wrote:
Okey so I have found a solution. The code doesn't work with tf 1.2, because it relies of tf.contrib.slim.summaries that was introduced in 1.3, running the code with tf 1.2 gives you AttributeError: 'module' object has no attribute 'add_scalar_summary'. However, the core issue was the matplotlib multithreading. I fixed the issue by using the Agg backend. I will send a pull request. @xcyan https://github.com/xcyan @arkanath https://github.com/arkanath
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/2160#issuecomment-321262480, or mute the thread https://github.com/notifications/unsubscribe-auth/ACpELPtBvztxOob1Fndfq54vEaModiA_ks5sWbqMgaJpZM4Ow70P .
-- Arkanath Pathak http://arkanath.com
@arkanath I can train the rotator successfully,but I can not train the PTN, the loss can not drop to low, and the images which be show in tensorboard is terrible. I install the tensorflow from conda,(not from source may problem?) could you give me some ideas? Thank you very much. I have been got stuck.