Newer
Older
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Running Tensorboard from Jupyter lab\n",
"====================================\n",
"---\n",
"Introduction au Deep Learning (IDLE) - S. Arias, E. Maldonado, JL. Parouty - CNRS/SARI/DEVLOG - 2020 \n",
"Vesion : 1.0"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Méthode 1 : Shell execute\n",
"**Start**"
]
},
{
"cell_type": "code",
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"execution_count": 220,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tensorbord started with pid 84593\n"
]
}
],
"source": [
"%%bash\n",
"tensorboard_start --logdir ./run/logs"
]
},
{
"cell_type": "code",
"execution_count": 225,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tensorboard process not found...\n"
]
}
],
"source": [
"%%bash\n",
"tensorboard_stop"
]
},
{
"cell_type": "code",
"execution_count": 79,
"metadata": {},
"outputs": [],
"source": [
"%%bash\n",
"\n",
"# ---- Port number, \n",
"PORT_JPY=\"$(id -u)\"\n",
"PORT_TSB=\"$(( $PORT_J + 10000 ))\"\n",
"HOST_G=\"$(hostname)\"\n",
"SSH_CMD=\"/usr/bin/ssh -NL 8888:$HOST_G:$PORT_J -L 6006:$HOST_G:$PORT_T dahu.ciment\"\n",
"\n",
"tensorboard --port 21277 --host 0.0.0.0 --logdir ./run/logs &>/dev/null &"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Check**"
]
},
{
"cell_type": "code",
"execution_count": 223,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"84593\n"
]
}
],
"source": [
"!echo $(ps ax | grep 'tensorboard --port 21277' | grep -v grep | awk '{print $1}')"
]
},
{
"cell_type": "code",
"execution_count": 202,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 83294 pts/0 Ss+ 0:00 /bin/sh -c ps ax | grep tensorboard\n",
" 83296 pts/0 S+ 0:00 grep tensorboard\n",
"/home/paroutyj/fidle/GTSRB\n"
]
}
],
"source": [
"!ps ax | grep tensorboard\n",
"!pwd"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Stop**"
]
},
{
"cell_type": "code",
"execution_count": 194,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ended (82555)\n"
]
}
],
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
"source": [
"%%bash\n",
"p=\"$(ps ax | grep 'tensorboard --port 21277' | grep -v grep | awk '{print $1}')\"\n",
"if [ -z ${p} ]; then echo \"No process\"; else kill $p; echo \"Ended ($p)\" ; fi"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Méthode 2 : Magic command\n",
"**Start**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%load_ext tensorboard"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%tensorboard --port 21277 --host 0.0.0.0 --logdir ./run/logs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Stop** \n",
"No way... use bash method\n",
"\n",
"## Methode 3 : Tensorboard module\n",
"\n",
"**Start**"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import tensorboard.notebook as tsb"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe id=\"tensorboard-frame-d4ce7dab09616bd4\" width=\"100%\" height=\"800\" frameborder=\"0\">\n",
" </iframe>\n",
" <script>\n",
" (function() {\n",
" const frame = document.getElementById(\"tensorboard-frame-d4ce7dab09616bd4\");\n",
" const url = new URL(\"/\", window.location);\n",
" url.port = 21277;\n",
" frame.src = url;\n",
" })();\n",
" </script>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"tsb.start('--port 21277 --host 0.0.0.0 --logdir ./run/logs')"
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Check**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"a=tsb.list()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Stop** \n",
"No way... use bash method"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}