-
Notifications
You must be signed in to change notification settings - Fork 1
/
notes.html
519 lines (425 loc) · 14.5 KB
/
notes.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Tensorflow: A Practical Introduction</title>
<meta name="author" content="(Alex Coventry)"/>
<style type="text/css">
.underline { text-decoration: underline; }
</style>
<link rel="stylesheet" href="./reveal.js/css/reveal.css"/>
<link rel="stylesheet" href="./reveal.js/css/theme/white.css" id="theme"/>
<link rel="stylesheet" href="./local.css"/>
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = './reveal.js/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<meta name="description" content="Tensorflow Introduction.">
</head>
<body>
<div class="reveal">
<div class="slides">
<section id="sec-title-slide"><h1 class="title">Tensorflow: A Practical Introduction</h1><h2 class="author">Alex Coventry</h2><p class="date">Created: 2017-01-12 Thu 08:55</p>
</section>
<section id="table-of-contents">
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#/slide-orgheadline1">What is Deep Learning?</a></li>
<li><a href="#/slide-orgheadline2">What is Tensorflow?</a></li>
<li><a href="#/slide-orgheadline3">The goal of this meetup</a></li>
<li><a href="#/slide-orgheadline13">Getting Started With Tensorflow</a></li>
<li><a href="#/slide-orgheadline14">InfoGAN</a></li>
<li><a href="#/slide-orgheadline15">Tensorboard</a></li>
<li><a href="#/slide-orgheadline16">Tensorboard</a></li>
<li><a href="#/slide-orgheadline17">Tensorboard</a></li>
<li><a href="#/slide-orgheadline18">How InfoGAN works</a></li>
<li><a href="#/slide-orgheadline19">Finer-grained architecture</a></li>
<li><a href="#/slide-orgheadline21">Extra notes</a></li>
</ul>
</div>
</div>
</section>
<section>
<section id="slide-orgheadline1">
<h2 id="orgheadline1">What is Deep Learning?</h2>
<ul>
<li>Automatically learning implicit representations from training data.</li>
<li>Layering increasingly abstract representations on top of each other.</li>
</ul>
<div class="figure">
<p><img src="./cnn_filters.png" alt="cnn_filters.png" width="75%" style="margin:0px auto;display:block" />
</p>
</div>
<p>
(<a href="http://www.iro.umontreal.ca/~bengioy/talks/DL-Tutorial-NIPS2015.pdf">http://www.iro.umontreal.ca/~bengioy/talks/DL-Tutorial-NIPS2015.pdf</a>)
</p>
</section>
</section>
<section>
<section id="slide-orgheadline2">
<h2 id="orgheadline2">What is Tensorflow?</h2>
<ul>
<li>A Python library for Machine Learning which emphasizes Deep Learning models.</li>
<li><a href="http://playground.tensorflow.org/#activation=tanh&batchSize=10&dataset=circle&regDataset=reg-plane&learningRate=0.03&regularizationRate=0&noise=0&networkShape=3,2&seed=0.35219&showTestData=true&discretize=false&percTrainData=50&x=true&y=true&xTimesY=false&xSquared=false&ySquared=false&cosX=false&sinX=false&cosY=false&sinY=false&collectStats=false&problem=classification&initZero=false&hideText=false">Example</a>.</li>
<li>A large suite of optimization algorithms and statistical tools.</li>
<li>Environment-agnostic notation for large classes of ML-related calculations:
Same program can run on a single CPU, a cluster, or a GPU, with minor
adjustments.</li>
<li><i>Tensor</i> flow because many calculations are linear, so represented by tensors
(multi-dimensional arrays of numbers.)</li>
<li>Tensor/flow/ because information flows from one layer to the next (forwards
and backwards) via the tensors.</li>
</ul>
</section>
</section>
<section>
<section id="slide-orgheadline3">
<h2 id="orgheadline3">The goal of this meetup</h2>
<ul>
<li>Practical demonstrations of how to use Tensorflow for Deep Learning.</li>
<li>Learn how to access the hardware and tools needed for serious experimentation
elaborate neural nets.</li>
<li>Learn to run the demonstrations yourself, and play with them to learn more.</li>
<li>If you run into a problem, speak up!</li>
<li>But time is short, so we may have to cut our losses and move on. Don't worry,
the slides will be available, and you can work through them on your own later.</li>
</ul>
<div class="figure">
<p><img src="https://cdn-images-1.medium.com/max/800/1*_91Ir1B68lDv_8kSRHa9bg.jpeg" alt="1*_91Ir1B68lDv_8kSRHa9bg.jpeg" width="75%" style="margin:0px auto;display:block" />
</p>
</div>
</section>
</section>
<section>
<section id="slide-orgheadline13">
<h2 id="orgheadline13">Getting Started With Tensorflow</h2>
<p>
Don't be intimidated! We'll take it step by step.
</p>
<p>
But to get serious work done, you need specialized hardware. We'll start by
showing you how to access it.
</p>
<p>
This is a bit involved, but once you've figured it out you'll be able to work on
neural nets independently!
</p>
<p>
Amazon offers a <a href="https://aws.amazon.com/marketplace/pp/B01M0AXXQB">Deep Learning AMI</a> which you can start with a single click. I
have found it slow to start up, but it may simpler to use at first.
</p>
</section>
</section>
<section>
<section id="slide-orgheadline4">
<h3 id="orgheadline4">Install firessh</h3>
<p>
If you already have an ssh client and know how to use it with a keyfile, you
don't need to do this.
</p>
<ul>
<li>Start chrome browser.</li>
<li>Search for "firessh chrome", and click on first link.</li>
<li>Click "Add to Chrome"</li>
</ul>
<div class="figure">
<p><img src="https://addons.cdn.mozilla.net/user-media/previews/full/61/61412.png" alt="61412.png" width="40%" style="margin:0px auto;display:block" />
</p>
</div>
</section>
</section>
<section>
<section id="slide-orgheadline5">
<h3 id="orgheadline5">Check whether you have the right AWS permissions</h3>
<ul>
<li>On aws.amazon.com, click on "Sign In to the Console" in the top right-hand
corner.</li>
<li>From the console, click on EC2 in the top left-hand corner.</li>
<li>Click on "Limits"</li>
<li>Search forwards (Control-F/Command-F) for "g2.2xlarge").</li>
<li>The value should be greater than 0.</li>
<li>If not, you can request a limit increase.</li>
<li>Other, more powerful instance types: g2.8xlarge, p2.* instances</li>
</ul>
</section>
</section>
<section>
<section id="slide-orgheadline6">
<h3 id="orgheadline6">Log into AWS and create a key</h3>
<p>
(If you already have a key, you don't need to do this.)
</p>
<ul>
<li>Click on "Key Pairs", under "Network and Security" on the left-hand side.</li>
<li>Click "Create Key Pair". Give it a name, click "Create".</li>
<li>Key is downloaded to your local hard drive. Make sure you know where it is.</li>
</ul>
</section>
</section>
<section>
<section id="slide-orgheadline7">
<h3 id="orgheadline7">Create a Tensorflow machine from scratch – EC2 instance</h3>
<ul>
<li>On aws.amazon.com, click on "Sign In to the Console" in the top right-hand
corner.</li>
<li>From the console, click on EC2 in the top left-hand corner.</li>
<li>Click on "Launch Instance"</li>
<li>Click on fourth "Select" button on right-hand side, for "Ubuntu Server"</li>
<li>Type Control-F, then "GPU". Click on "g2.2xlarge" row.</li>
<li>Click on "Configure Instance Details", then "Add storage". Change size from 8
to 16.</li>
<li>Click on "Configure Security Group", then "Add Rule."</li>
<li>Set port to 8888 and source to "Anywhere." (Opens the firewall on port 8888.)
Open port 7777 in the same way.</li>
<li>Click on "Review and Launch", then "Launch."</li>
<li>Choose the key you created, check acknowledgement box, and launch</li>
</ul>
</section>
</section>
<section>
<section id="slide-orgheadline8">
<h3 id="orgheadline8">Make sure you know how to get rid of the machine</h3>
<ul>
<li>From the Instances console, right click on the machine. Choose "Instance
State". Choose "Stop" to shut the machine down. Choose "Terminate" to remove
the machine altogether.</li>
<li>While running, the machine costs 65c / hour.</li>
<li>While it exists, its storage costs $1.60 / month.</li>
</ul>
</section>
</section>
<section>
<section id="slide-orgheadline9">
<h3 id="orgheadline9">Connect to the Tensorflow machine</h3>
<ul>
<li>Click on the instance id ("i-<alphnumerics>"). In the bottom it will say
something like "Public DNS: ec2-…compute-1.amazonaws.com". Take
a copy of the "ec2-….amazonaws.com" address.</li>
<li>In chrome, go to <code>chrome://apps</code> and choose firessh. (Or use your own ssh
client if you prefer.)</li>
<li>Enter anything you like for "Account Name", the DNS address for the "Host",
"ubuntu" for the login, and use the "choose file" button to choose the local
key file you created two slides ago.</li>
<li>Click "Connect."</li>
</ul>
</section>
</section>
<section>
<section id="slide-orgheadline10">
<h3 id="orgheadline10">Starting a machine through coventry.systems</h3>
<ul>
<li>Go to <a href="https://coventry.systems/">https://coventry.systems/</a>.</li>
<li>Enter the 12-digit token you bought, or pay by credit card ($6).</li>
<li>Enter a password (all digits and numbers)</li>
<li>Re-enter password, enter name & email.</li>
<li>Hit submit</li>
</ul>
<pre class="example">
Machine State: Running
Hostname: ec2-54-211-250-185.compute-1.amazonaws.com
Username: ubuntu
Password: The one you provided
</pre>
</section>
</section>
<section>
<section id="slide-orgheadline11">
<h3 id="orgheadline11">Installation</h3>
<p>
Run these commands:
</p>
<pre class="example">
tmux
git clone https://github.com/coventry/tfintro
cd tfintro
sudo bash
bash ./install.sh
</pre>
<p>
This will take a few minutes.
</p>
</section>
</section>
<section>
<section id="slide-orgheadline12">
<h3 id="orgheadline12">Start the Tensorflow container</h3>
<pre class="example">
% sudo bash ./run-tensorflow.sh
root@d6ed7524ce0e:/#
</pre>
<p>
From here, we have a working instance of tensorflow!
</p>
<p>
Let's start the ipython notebook.
</p>
<p>
(<b><b>HIGHLY INSECURE!! DO NOT USE THIS FOR CONFIDENTIAL WORK</b></b>)
</p>
<pre class="example">
# tmux
# cd /tensorflow/tensorflow/tools/docker/notebooks/
# jupyter-notebook
</pre>
<p>
Now browse to ec2-….amazonaws.com:8888, where ec2-… is the address of your
machine.
</p>
<p>
These notebooks are a very useful introduction to tensorflow. Only the last one
really needs a GPU.
</p>
<div class="figure">
<p><img src="./hellotensorflow.png" alt="hellotensorflow.png" />
</p>
</div>
</section>
</section>
<section>
<section id="slide-orgheadline14">
<h2 id="orgheadline14">InfoGAN</h2>
<p>
Back to the ssh terminal. Type "Control-B Control-B C" to open a new shell in the
docker container. ("Control-B C" would open one on the host.)
</p>
<p>
Then type the following:
</p>
<pre class="example">
git clone https://github.com/coventry/InfoGAN
cd InfoGAN
PYTHONPATH=. python launchers/run_mnist_exp.py
</pre>
<p>
Then "Control-B Control-B C" for yet another shell, and
</p>
<pre class="example">
tensorboard --port 7777 --logdir logs/mnist
</pre>
</section>
</section>
<section>
<section id="slide-orgheadline15">
<h2 id="orgheadline15">Tensorboard</h2>
<div class="figure">
<p><img src="tensorboard-images.png" alt="tensorboard-images.png" width="100%" style="margin:0px auto;display:block" />
</p>
</div>
</section>
</section>
<section>
<section id="slide-orgheadline16">
<h2 id="orgheadline16">Tensorboard</h2>
<div class="figure">
<p><img src="tensorboard-events.png" alt="tensorboard-events.png" width="100%" style="margin:0px auto;display:block" />
</p>
</div>
</section>
</section>
<section>
<section id="slide-orgheadline17">
<h2 id="orgheadline17">Tensorboard</h2>
<div class="figure">
<p><img src="tensorboard-graphs.png" alt="tensorboard-graphs.png" width="100%" style="margin:0px auto;display:block" />
</p>
</div>
</section>
</section>
<section>
<section id="slide-orgheadline18">
<h2 id="orgheadline18">How InfoGAN works</h2>
<div class="figure">
<p><img src="infogan-architecture.png" alt="infogan-architecture.png" width="30%" style="margin:0px auto;display:block" />
</p>
</div>
<p>
(From buriburisuri/ac-gan)
</p>
</section>
</section>
<section>
<section id="slide-orgheadline19">
<h2 id="orgheadline19">Finer-grained architecture</h2>
<div class="figure">
<p><img src="dcgan_network.png" alt="dcgan_network.png" />
</p>
</div>
<p>
(<a href="http://www.derinogrenme.com/tag/zeynep-akata/">http://www.derinogrenme.com/tag/zeynep-akata/</a>)
</p>
</section>
</section>
<section>
<section id="slide-orgheadline21">
<h2 id="orgheadline21">Extra notes</h2>
<div class="outline-text-2" id="text-orgheadline21">
</div></section>
</section>
<section>
<section id="slide-orgheadline20">
<h3 id="orgheadline20">Create AWS account</h3>
<p>
(No need to read this if you already have an account)
</p>
<ul>
<li>Go to aws.amazon.com</li>
<li>Click on "Create AWS account" in top right-hand corner</li>
<li>Enter email address, click "I am a new user", click "Sign in"</li>
<li>Fill out info, click "Create account"</li>
<li>Fill out info. For "security check", don't include spaces. Click "Check here",
click "Create Account"</li>
<li>Fill out credit card info, click "Continue"</li>
<li>After another "security check," give a telephone number.</li>
<li>They'll call your number, enter the given code. Click "Continue"</li>
<li>Click "Continue" again.</li>
<li>Click "Sign in to the console."</li>
</ul>
</section>
</section>
</div>
</div>
<p> Created by Alex Coventry. </p>
<script src="./reveal.js/lib/js/head.min.js"></script>
<script src="./reveal.js/js/reveal.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: false,
center: true,
slideNumber: 'c',
rollingLinks: true,
keyboard: true,
overview: true,
width: 1200,
height: 800,
margin: 0.10,
minScale: 0.50,
maxScale: 2.50,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'cube', // default/cube/page/concave/zoom/linear/fade/none
transitionSpeed: 'default',
multiplex: {
secret: '', // null if client
id: '', // id, obtained from socket.io server
url: '' // Location of socket.io server
},
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: './reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: './reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: './reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }]
});
</script>
</body>
</html>