-
Notifications
You must be signed in to change notification settings - Fork 0
/
char-rnn-generation.ipynb.txt
701 lines (701 loc) · 41.2 KB
/
char-rnn-generation.ipynb.txt
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
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](https://i.imgur.com/eBRPvWB.png)\n",
"\n",
"# Practical PyTorch: Generating Shakespeare with a Character-Level RNN\n",
"\n",
"[In the RNN classification tutorial](https://github.com/spro/practical-pytorch/blob/master/char-rnn-classification/char-rnn-classification.ipynb) we used a RNN to classify text one character at a time. This time we'll generate text one character at a time.\n",
"\n",
"```\n",
"> python generate.py -n 500\n",
"\n",
"PAOLTREDN:\n",
"Let, yil exter shis owrach we so sain, fleas,\n",
"Be wast the shall deas, puty sonse my sheete.\n",
"\n",
"BAUFIO:\n",
"Sirh carrow out with the knonuot my comest sifard queences\n",
"O all a man unterd.\n",
"\n",
"PROMENSJO:\n",
"Ay, I to Heron, I sack, againous; bepear, Butch,\n",
"An as shalp will of that seal think.\n",
"\n",
"NUKINUS:\n",
"And house it to thee word off hee:\n",
"And thou charrota the son hange of that shall denthand\n",
"For the say hor you are of I folles muth me?\n",
"```\n",
"\n",
"This one might make you question the series title — \"is that really practical?\" However, these sorts of generative models form the basis of machine translation, image captioning, question answering and more. See the [Sequence to Sequence Translation tutorial](https://github.com/spro/practical-pytorch/blob/master/seq2seq-translation/seq2seq-translation.ipynb) for more on that topic."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Recommended Reading\n",
"\n",
"I assume you have at least installed PyTorch, know Python, and understand Tensors:\n",
"\n",
"* http://pytorch.org/ For installation instructions\n",
"* [Deep Learning with PyTorch: A 60-minute Blitz](https://github.com/pytorch/tutorials/blob/master/Deep%20Learning%20with%20PyTorch.ipynb) to get started with PyTorch in general\n",
"* [jcjohnson's PyTorch examples](https://github.com/jcjohnson/pytorch-examples) for an in depth overview\n",
"* [Introduction to PyTorch for former Torchies](https://github.com/pytorch/tutorials/blob/master/Introduction%20to%20PyTorch%20for%20former%20Torchies.ipynb) if you are former Lua Torch user\n",
"\n",
"It would also be useful to know about RNNs and how they work:\n",
"\n",
"* [The Unreasonable Effectiveness of Recurrent Neural Networks](http://karpathy.github.io/2015/05/21/rnn-effectiveness/) shows a bunch of real life examples\n",
"* [Understanding LSTM Networks](http://colah.github.io/posts/2015-08-Understanding-LSTMs/) is about LSTMs specifically but also informative about RNNs in general\n",
"\n",
"Also see these related tutorials from the series:\n",
"\n",
"* [Classifying Names with a Character-Level RNN](https://github.com/spro/practical-pytorch/blob/master/char-rnn-classification/char-rnn-classification.ipynb) uses an RNN for classification\n",
"* [Generating Names with a Conditional Character-Level RNN](https://github.com/spro/practical-pytorch/blob/master/conditional-char-rnn/conditional-char-rnn.ipynb) builds on this model to add a category as input"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Prepare data\n",
"\n",
"The file we are using is a plain text file. We turn any potential unicode characters into plain ASCII by using the `unidecode` package (which you can install via `pip` or `conda`)."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"file_len = 1115394\n"
]
}
],
"source": [
"import unidecode\n",
"import string\n",
"import random\n",
"import re\n",
"\n",
"all_characters = string.printable\n",
"n_characters = len(all_characters)\n",
"\n",
"file = unidecode.unidecode(open('../data/shakespeare.txt').read())\n",
"file_len = len(file)\n",
"print('file_len =', file_len)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To make inputs out of this big string of data, we will be splitting it into chunks."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" will continue that I broach'd in jest.\n",
"I can, Petruchio, help thee to a wife\n",
"With wealth enough and young and beauteous,\n",
"Brought up as best becomes a gentlewoman:\n",
"Her only fault, and that is faults en\n"
]
}
],
"source": [
"chunk_len = 200\n",
"\n",
"def random_chunk():\n",
" start_index = random.randint(0, file_len - chunk_len)\n",
" end_index = start_index + chunk_len + 1\n",
" return file[start_index:end_index]\n",
"\n",
"print(random_chunk())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Build the Model\n",
"\n",
"This model will take as input the character for step $t_{-1}$ and is expected to output the next character $t$. There are three layers - one linear layer that encodes the input character into an internal state, one GRU layer (which may itself have multiple layers) that operates on that internal state and a hidden state, and a decoder layer that outputs the probability distribution."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import torch\n",
"import torch.nn as nn\n",
"from torch.autograd import Variable\n",
"\n",
"class RNN(nn.Module):\n",
" def __init__(self, input_size, hidden_size, output_size, n_layers=1):\n",
" super(RNN, self).__init__()\n",
" self.input_size = input_size\n",
" self.hidden_size = hidden_size\n",
" self.output_size = output_size\n",
" self.n_layers = n_layers\n",
" \n",
" self.encoder = nn.Embedding(input_size, hidden_size)\n",
" self.gru = nn.GRU(hidden_size, hidden_size, n_layers)\n",
" self.decoder = nn.Linear(hidden_size, output_size)\n",
" \n",
" def forward(self, input, hidden):\n",
" input = self.encoder(input.view(1, -1))\n",
" output, hidden = self.gru(input.view(1, 1, -1), hidden)\n",
" output = self.decoder(output.view(1, -1))\n",
" return output, hidden\n",
"\n",
" def init_hidden(self):\n",
" return Variable(torch.zeros(self.n_layers, 1, self.hidden_size))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Inputs and Targets"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Each chunk will be turned into a tensor, specifically a `LongTensor` (used for integer values), by looping through the characters of the string and looking up the index of each character in `all_characters`."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Variable containing:\n",
" 10\n",
" 11\n",
" 12\n",
" 39\n",
" 40\n",
" 41\n",
"[torch.LongTensor of size 6]\n",
"\n"
]
}
],
"source": [
"# Turn string into list of longs\n",
"def char_tensor(string):\n",
" tensor = torch.zeros(len(string)).long()\n",
" for c in range(len(string)):\n",
" tensor[c] = all_characters.index(string[c])\n",
" return Variable(tensor)\n",
"\n",
"print(char_tensor('abcDEF'))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Finally we can assemble a pair of input and target tensors for training, from a random chunk. The input will be all characters *up to the last*, and the target will be all characters *from the first*. So if our chunk is \"abc\" the input will correspond to \"ab\" while the target is \"bc\"."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def random_training_set(): \n",
" chunk = random_chunk()\n",
" inp = char_tensor(chunk[:-1])\n",
" target = char_tensor(chunk[1:])\n",
" return inp, target"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Evaluating\n",
"\n",
"To evaluate the network we will feed one character at a time, use the outputs of the network as a probability distribution for the next character, and repeat. To start generation we pass a priming string to start building up the hidden state, from which we then generate one character at a time."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def evaluate(prime_str='A', predict_len=100, temperature=0.8):\n",
" hidden = decoder.init_hidden()\n",
" prime_input = char_tensor(prime_str)\n",
" predicted = prime_str\n",
"\n",
" # Use priming string to \"build up\" hidden state\n",
" for p in range(len(prime_str) - 1):\n",
" _, hidden = decoder(prime_input[p], hidden)\n",
" inp = prime_input[-1]\n",
" \n",
" for p in range(predict_len):\n",
" output, hidden = decoder(inp, hidden)\n",
" \n",
" # Sample from the network as a multinomial distribution\n",
" output_dist = output.data.view(-1).div(temperature).exp()\n",
" top_i = torch.multinomial(output_dist, 1)[0]\n",
" \n",
" # Add predicted character to string and use as next input\n",
" predicted_char = all_characters[top_i]\n",
" predicted += predicted_char\n",
" inp = char_tensor(predicted_char)\n",
"\n",
" return predicted"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Training"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A helper to print the amount of time passed:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import time, math\n",
"\n",
"def time_since(since):\n",
" s = time.time() - since\n",
" m = math.floor(s / 60)\n",
" s -= m * 60\n",
" return '%dm %ds' % (m, s)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The main training function"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def train(inp, target):\n",
" hidden = decoder.init_hidden()\n",
" decoder.zero_grad()\n",
" loss = 0\n",
"\n",
" for c in range(chunk_len):\n",
" output, hidden = decoder(inp[c], hidden)\n",
" loss += criterion(output, target[c])\n",
"\n",
" loss.backward()\n",
" decoder_optimizer.step()\n",
"\n",
" return loss.data[0] / chunk_len"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then we define the training parameters, instantiate the model, and start training:"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false,
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0m 19s (100 5%) 2.1267]\n",
"Wh! 'Lod at the to Cell I dy\n",
"Whapesfe show dous that,\n",
"But thes lo he ther, letrst surave and and cod a \n",
"\n",
"[0m 38s (200 10%) 1.9876]\n",
"Whan the she ciching, doove whath that he gone prie hasigrow nice knotat by wiith haye! ha coll, and i \n",
"\n",
"[0m 59s (300 15%) 2.0772]\n",
"Whurgre of nowif for of agand witeling in fromound be noyed th well and fort and withen a custrone fri \n",
"\n",
"[1m 19s (400 20%) 1.9062]\n",
"Why sleemer chome, I\n",
"tence lord thou let not mories, Wherly me cloonger on wit, me cre wort if thing i \n",
"\n",
"[1m 39s (500 25%) 1.9632]\n",
"Whank of winded than inderreast, hids for hink marry, I son will now my be tor think that I be uncient \n",
"\n",
"[2m 0s (600 30%) 1.9364]\n",
"What to youre\n",
"Good the dorsentemat.\n",
"What the not what a meifery part is be of look\n",
"Whait of the hall w \n",
"\n",
"[2m 20s (700 35%) 1.8673]\n",
"Whes Bester,\n",
"Bars, and and most man\n",
"ingeld my tiement make I lesiefoden as do you same to muse woke o' \n",
"\n",
"[2m 40s (800 40%) 2.1523]\n",
"Whe my bone a me but mast at the face.\n",
"Whe he frend him cope a be to with I comes or he God his for ma \n",
"\n",
"[3m 1s (900 45%) 1.8042]\n",
"Whis our namure.\n",
"\n",
"TRANIO:\n",
"May platis the lord,\n",
"I wis he we but he hards paron's we for the surven neav \n",
"\n",
"[3m 21s (1000 50%) 1.9770]\n",
"Whis, is at ell demes sy host is in\n",
"The revention eart-aly, his the couth stare.\n",
"The streath, the so h \n",
"\n",
"[3m 42s (1100 55%) 1.9771]\n",
"Which the called these what mace all bries,\n",
"Gow the from ceart repise--tring be of the\n",
"Hee he that, of \n",
"\n",
"[4m 3s (1200 60%) 1.7054]\n",
"What that hays how the frow he dresers gard.\n",
"\n",
"BAPTISTA:\n",
"That was on a prain their with to goe, all me\n",
" \n",
"\n",
"[4m 23s (1300 65%) 1.6584]\n",
"Whe time, like\n",
"Those paurstriet.\n",
"\n",
"SICINIUS:\n",
"Glow a and elfers; rother's Rome servest enon't is may thu \n",
"\n",
"[4m 44s (1400 70%) 1.7370]\n",
"When him these;\n",
"There and of Have the in of the do best veath and hever the chaw, not pites with at my \n",
"\n",
"[5m 6s (1500 75%) 1.6769]\n",
"Wher he have live the courtas,\n",
"I here that whils him I shee my like deated,\n",
"To countert a hardor of so \n",
"\n",
"[5m 26s (1600 80%) 1.7480]\n",
"Wh for the grone them with are\n",
"Belent dis are couch of my to tell ding.\n",
"\n",
"Sir:\n",
"What the deatred thou as \n",
"\n",
"[5m 48s (1700 85%) 1.7725]\n",
"Why.\n",
"\n",
"CUMETEL:\n",
"I carcithy place, did the forling like grease in ratenforer;\n",
"Which ot chatuse, be thy p \n",
"\n",
"[6m 8s (1800 90%) 1.6781]\n",
"What feath wifiten,\n",
"Thou kind Maner'd my king: I'll thou\n",
"Reven's my streathence,\n",
"By civery sow'd king' \n",
"\n",
"[6m 28s (1900 95%) 1.5265]\n",
"What so srome the and any strand?\n",
"\n",
"BAPTISTA:\n",
"Not bother hear are a common int.\n",
"\n",
"QUEEN MIRGANSIO:\n",
"I say \n",
"\n",
"[6m 49s (2000 100%) 1.5479]\n",
"Why, ruse the tort,\n",
"And whese a to the vill bear not tell not the the borwading.\n",
"\n",
"JULIET:\n",
"In be our no \n",
"\n"
]
}
],
"source": [
"n_epochs = 2000\n",
"print_every = 100\n",
"plot_every = 10\n",
"hidden_size = 100\n",
"n_layers = 1\n",
"lr = 0.005\n",
"\n",
"decoder = RNN(n_characters, hidden_size, n_characters, n_layers)\n",
"decoder_optimizer = torch.optim.Adam(decoder.parameters(), lr=lr)\n",
"criterion = nn.CrossEntropyLoss()\n",
"\n",
"start = time.time()\n",
"all_losses = []\n",
"loss_avg = 0\n",
"\n",
"for epoch in range(1, n_epochs + 1):\n",
" loss = train(*random_training_set()) \n",
" loss_avg += loss\n",
"\n",
" if epoch % print_every == 0:\n",
" print('[%s (%d %d%%) %.4f]' % (time_since(start), epoch, epoch / n_epochs * 100, loss))\n",
" print(evaluate('Wh', 100), '\\n')\n",
"\n",
" if epoch % plot_every == 0:\n",
" all_losses.append(loss_avg / plot_every)\n",
" loss_avg = 0"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Plotting the Training Losses\n",
"\n",
"Plotting the historical loss from all_losses shows the network learning:"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x11079f780>]"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAg0AAAFkCAYAAACjCwibAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzt3Xl8VNX5x/HvYd8XUVlEq4JawAVZBAQFQUDBam1FjRtg\nfwqIRdGq1brUDXfUqohb645Wq+KGgKggIqJBtFpQFEQQZVMCsggh5/fHk+tMhklyJ5lkbpLP+/Wa\n12Tu3OXM3MncZ855zjnOey8AAIDiVMt0AQAAQMVA0AAAAEIhaAAAAKEQNAAAgFAIGgAAQCgEDQAA\nIBSCBgAAEApBAwAACIWgAQAAhELQAAAAQilV0OCc+6tzLs85N76Y9fo457Kdc1udc18654aW5rgA\nAKD8lThocM51lXSupE+KWW9vSa9KmiHpEEl3S3rYOde/pMcGAADlr0RBg3OugaQnJf2fpPXFrD5K\n0hLv/aXe+y+89/dJel7S2JIcGwAAZEZJaxruk/SK9/6tEOt2l/RmwrKpknqU8NgAACADaqS6gXPu\nVEkdJXUJuUkLSasSlq2S1Mg5V9t7/0uSYzSTNFDSN5K2plpGAACqsDqS9pY01Xu/Lp07TilocM61\nlnSXpKO999vTWZAEAyU9VYb7BwCgsjtd0tPp3GGqNQ2dJe0mab5zzuUvqy7pSOfc+ZJqe+99wjY/\nSGqesKy5pA3JahnyfSNJTz75pNq1a5diERFFY8eO1Z133pnpYiBNOJ+VC+ezclm4cKHOOOMMKf9a\nmk6pBg1vSjooYdmjkhZKujlJwCBJ70s6NmHZgPzlhdkqSe3atVOnTp1SLCKiqHHjxpzLSoTzWblw\nPiuttDfvpxQ0eO83Sfpf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lbXLOBTUKOd77rfl/\nl8//aKa7jiTpSnJe/gveIot+umS6TNxCnbdJ+R/QLbJs3Kcl7ZOwzt9l3YI2y76Y2ma63Nx+PTe9\nZV2vdiTc/hn2/EmqLetLvjb/C+k5Sbtn+rVV1VtR51Q24/AbsoBhq6Qlku6XtBvnNHq3Qs7jDkln\nJaxX5v+jTFgFAABCiUxOAwAAiDaCBgAAEApBAwAACIWgAQAAhELQAAAAQiFoAAAAoRA0AACAUAga\nAABAKAQNAAAgFIIGAAAQCkEDAAAI5f8BEXt19l83XNQAAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x106e39da0>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"import matplotlib.ticker as ticker\n",
"%matplotlib inline\n",
"\n",
"plt.figure()\n",
"plt.plot(all_losses)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Evaluating at different \"temperatures\"\n",
"\n",
"In the `evaluate` function above, every time a prediction is made the outputs are divided by the \"temperature\" argument passed. Using a higher number makes all actions more equally likely, and thus gives us \"more random\" outputs. Using a lower value (less than 1) makes high probabilities contribute more. As we turn the temperature towards zero we are choosing only the most likely outputs.\n",
"\n",
"We can see the effects of this by adjusting the `temperature` argument."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Thoo head strant me reporce\n",
"O and hears of thou provand of treech.\n",
"\n",
"LUCI death in that to tellon is head thing come thou that to not him with your firsure but,\n",
"They here thyse of yet in thou thy meat to\n"
]
}
],
"source": [
"print(evaluate('Th', 200, temperature=0.8))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Lower temperatures are less varied, choosing only the more probable outputs:"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"This commanderence the forself to the the to the the the to the to the the formands\n",
"What to the strange the boy the the have the the to the to to the formands\n",
"That the the the the the the sorn the to th\n"
]
}
],
"source": [
"print(evaluate('Th', 200, temperature=0.2))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Higher temperatures more varied, choosing less probable outputs:"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"That,\n",
"henct wto Haste's, norsee'd stave brYiry's is dsem.\n",
"Hell hurss Heamous halloR:\n",
"Tht a readerty the!\n",
"\n",
"KuWhrate.\n",
"\n",
"VLOMAY, mere's no, toojecur' kong.\n",
"\n",
"DUKE VIx whJos ivistomzliben\n",
"The vrieglad bloot, \n"
]
}
],
"source": [
"print(evaluate('Th', 200, temperature=1.4))"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"# Exercises\n",
"\n",
"* Train with your own dataset, e.g.\n",
" * Text from another author\n",
" * Blog posts\n",
" * Code\n",
"* Increase number of layers and network size to get better results"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Next**: [Generating Names with a Conditional Character-Level RNN](https://github.com/spro/practical-pytorch/blob/master/conditional-char-rnn/conditional-char-rnn.ipynb)"
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [conda root]",
"language": "python",
"name": "conda-root-py"
},
"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.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}