This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def plot_loss_change(sched, sma=1, n_skip=20, y_lim=(-0.01,0.01)): | |
| """ | |
| Plots rate of change of the loss function. | |
| Parameters: | |
| sched - learning rate scheduler, an instance of LR_Finder class. | |
| sma - number of batches for simple moving average to smooth out the curve. | |
| n_skip - number of batches to skip on the left. | |
| y_lim - limits for the y axis. | |
| """ | |
| derivatives = [0] * (sma + 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2014 Google Inc. All Rights Reserved. | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| u: (<<[cancel close] membership>>) | |
| Would you like to cancel your membership immediately? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| r = Rule( | |
| And( | |
| Or('cancel', 'close'), | |
| 'membership', | |
| Respond('Would you like to cancel your membership immediately?')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def isRefundRequest(message): | |
| return 'pay' in message or 'order' in message |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sat Oct 15 01:51:04 2016 | |
| +------------------------------------------------------+ | |
| | NVIDIA-SMI 352.39 Driver Version: 352.39 | | |
| |-------------------------------+----------------------+----------------------+ | |
| | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | |
| | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | |
| |===============================+======================+======================| | |
| | 0 GeForce GTX 980 Ti Off | 0000:01:00.0 Off | N/A | | |
| | 32% 53C P2 96W / 250W | 5881MiB / 6142MiB | 56% Default | | |
| +-------------------------------+----------------------+----------------------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Thu Oct 13 20:14:11 2016 | |
| +------------------------------------------------------+ | |
| | NVIDIA-SMI 352.39 Driver Version: 352.39 | | |
| |-------------------------------+----------------------+----------------------+ | |
| | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | |
| | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | |
| |===============================+======================+======================| | |
| | 0 GeForce GTX 980 Ti Off | 0000:01:00.0 Off | N/A | | |
| | 29% 46C P8 26W / 250W | 124MiB / 6142MiB | 0% Default | | |
| +-------------------------------+----------------------+----------------------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def _next_device(self): | |
| """Round robin the gpu device. (Reserve last gpu for expensive op).""" | |
| if self._num_gpus == 0: | |
| return '' | |
| dev = '/gpu:%d' % self._cur_gpu | |
| self._cur_gpu = (self._cur_gpu + 1) % (self._num_gpus-1) | |
| return dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Train on CNN data (cnn-train, cnn-vocab): | |
| bazel-bin/textsum/seq2seq_attention \ | |
| --mode=train \ | |
| --article_key=article \ | |
| --abstract_key=abstract \ | |
| --data_path=data/cnn-train.bin \ | |
| --vocab_path=data/cnn-vocab.bin \ | |
| --log_root=log_root \ | |
| --train_dir=log_root/train \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| python textsum_data_convert.py \ | |
| --command text_to_vocabulary \ | |
| --in_directories cnn/stories \ | |
| --out_files cnn-vocab | |
| python textsum_data_convert.py \ | |
| --command text_to_binary \ | |
| --in_directories cnn/stories \ | |
| --out_files cnn-train.bin,cnn-validation.bin,cnn-test.bin \ | |
| --split 0.8,0.15,0.05 |