> %s
= %s
< %s
' % (input_sentence, target_sentence, output_sentence)\n", " vis.text(text, win=win, opts={'title': win})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Putting it all together\n", "\n", "**TODO** Run `train_epochs` for `n_epochs`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To actually train, we call the train function many times, printing a summary as we go.\n", "\n", "*Note:* If you're running this notebook you can **train, interrupt, evaluate, and come back to continue training**. Simply run the notebook starting from the following cell (running from the previous cell will reset the models)." ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/sean/anaconda3/lib/python3.6/site-packages/torch/backends/cudnn/__init__.py:46: UserWarning: PyTorch was compiled without cuDNN support. To use cuDNN, rebuild PyTorch making sure the library is visible to the build system.\n", " \"PyTorch was compiled without cuDNN support. To use cuDNN, rebuild \"\n", "/home/sean/Projects/practical-pytorch/seq2seq-translation/masked_cross_entropy.py:9: UserWarning: torch.range is deprecated in favor of torch.arange and will be removed in 0.3. Note that arange generates values in [start; end), not [start; end].\n", " seq_range = torch.range(0, max_len - 1).long()\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "[log] 1m 50s (100) 3.1331\n", "1m 50s (- 921m 56s) (100 0%) 3.8196\n", "[log] 3m 41s (200) 2.3766\n", "3m 41s (- 921m 4s) (200 0%) 2.7289\n", "[log] 5m 35s (300) 2.1629\n", "5m 35s (- 926m 34s) (300 0%) 2.2523\n", "[log] 7m 28s (400) 1.9996\n", "7m 28s (- 926m 21s) (400 0%) 1.9320\n", "[log] 9m 20s (500) 1.5955\n", "9m 20s (- 924m 47s) (500 1%) 1.6854\n", "[log] 11m 13s (600) 1.2429\n", "11m 13s (- 924m 11s) (600 1%) 1.4429\n", "[log] 13m 5s (700) 1.2304\n", "13m 5s (- 922m 26s) (700 1%) 1.2527\n", "[log] 14m 57s (800) 0.9507\n", "14m 57s (- 919m 49s) (800 1%) 1.1110\n", "[log] 16m 49s (900) 0.8307\n", "16m 49s (- 917m 34s) (900 1%) 0.9817\n", "[log] 18m 39s (1000) 0.7994\n", "18m 39s (- 914m 34s) (1000 2%) 0.8726\n", "> suis je en retard ?\n", "= am i late ?\n", "< am i late ?