Debugging tensorflow remotely

Debugging tensorflow remotely

When trying to work with Tensorflow, I was trying debugging it in a Linux (with a lot of memories) server but the command line is not easy to use and track the variable values. After searching in the web, I found out that PyCharm allows users to remotely debug a python script and most importantly, it is free :). Here are the steps that I used to debug a python script in a Linux server.

  • Install tensorflow in the Linux as in this link: https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html
  • Make sure you can run an example of the python script. In my case, I am running the python script in this tutorial https://www.tensorflow.org/versions/r0.11/tutorials/recurrent/index.html

~/tensorflow/tensorflow/models/rnn/ptb$ python ptb_word_lm.py –data_path=/home/hellovn/RNN/data/data/ –model small

  • Install PyCharm which is free if you are a University student and supports Windows and Mac OS X. Awesome 🙂
  • Copy the two egg files (i used a Windows machine to debug it) in C:\Program Files (x86)\JetBrains\PyCharm 2016.2.3\debug-eggs to the remote server.
  • Insert the scripts into your remote python script at the top:

import sys
sys.path.append(‘/home/hellovn/debug-eggs/pycharm-debug.egg’)

import pydevd
pydevd.settrace(‘servername’, port=8080, suspend=False)

  • Open the port (8080 in my case) from the home router.
  • Start the debug server from your local computer. Here is an example of the Debug configuration. The local host name is the your home server URL. You can get familiar with setting up a home server in this link: (http://www.noip.com/support/knowledgebase/getting-started-with-no-ip-com/)
  • tensor
  • Run the python script in your remote server.
  • The script will automatically connect to your home debugger server.

 


anh

Leave a Reply

Your email address will not be published. Required fields are marked *