-
Notifications
You must be signed in to change notification settings - Fork 45.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add different rnn implementation modes to ptb tutorial #2276
Conversation
I just signed cla. |
Run googlebot again. |
479285f
to
75ba6b5
Compare
…M and LSTMBlockCell. rnn_mode == CUDNN =================================================== | config | epochs | train | valid | test | wps ==================================================== | small | 13 | 40.50 | 116.60 | 112.13 | 49k | medium | 39 | 22.58 | 123.83 | 118.69 | 24.2k | large | 55 | 8.03 | 129.78 | 126.03 | 10.5k ==================================================== In fact, the params tensor layout for cudnn_lstm is so different from canonical LSTM, we need a complete different set of init_scale and learning rate parameters. rnn_mode == BLOCK =================================================== | config | epochs | train | valid | test | wps ==================================================== | small | 13 | 40.55 | 120.70 | 115.52 | 17.2k | medium | 39 | 45.68 | 86.97 | 83.47 | 13.6k | large | 55 | 37.94 | 82.75 | 78.49 | 5.0k ==================================================== Wps before this cl for small, medium, large models are 15.6k, 12.6k, and 5.0k, respectively. Benchmarking platform: E5-2690 v4, Titan X.
Sync with sequence_loss change.
tutorials/rnn/ptb/ptb_word_lm.py
Outdated
import reader | ||
from google3.third_party.tensorflow_models.tutorials.rnn.ptb import reader | ||
from google3.third_party.tensorflow_models.tutorials.rnn.ptb import util | ||
from google3.third_party.tensorflow.python.client import device_lib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the google3 imports? Also, we don't have a util.py
file in this folder, and I'm not sure whether we can import device_lib
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. PTAL.
Tested on my local machine.
Update BUILD
PTAL. |
Looks good at a glance. I'll try to run it on my machine tomorrow and see how it does. |
👍 Got the following results with the medium model: Epoch: 39 Train Perplexity: 45.733 |
…gle3 This will error when num_gpus > 1
This cl is buggy and should be reverted: First, the CUDNN backend doesn't make sense:
Second, the CL pulled old code for the basic LSTM, making it incompatible with the new Tensorflow, see e.g. #8191. |
Re janchorowski@
Second: |
Hi, I aplogize for speaking too soon. I had two problems with running the new code and blamed it to this change:
|
Re janchorowski@ Thanks for the details. You're right the cell is reused, thanks for catching that. Would you create a PR since you've invested a lot of time in it? We can review it. Thank you. |
See: tensorflow#2276 (comment) Signed-off-by: MrD <the.ubik@gmail.com>
Does the commit linked above fix the problem with reusing the same cell ? If yes I could submit a PR |
@bignamehyp @protoget Does that change by @Utumno seem good to you? See #934 for some context. |
LGTM if it passes quality tests. |
@Utumno could you submit your PR and @-mention us? |
Thanks, will do ASAP but please merge #2403 first - it's needed so this even runs on python 3 and it will be in my pull otherwise |
@Utumno Sure thing, merged. |
See: tensorflow#2276 (comment) Signed-off-by: MrD <the.ubik@gmail.com>
…gle3 This will error when num_gpus > 1
Does anyone can tell me the difference between "canonical LSTM cells" and "block or CUDNN cells"? Correct me if I am wrong. |
Add different rnn implementation modes to ptb tutorial using CudnnLSTM and LSTMBlockCell.
rnn_mode == CUDNN
| config | epochs | train | valid | test | wps
| small | 13 | 40.50 | 116.60 | 112.13 | 49k
| medium | 39 | 22.58 | 123.83 | 118.69 | 24.2k
| large | 55 | 8.03 | 129.78 | 126.03 | 10.5k
In fact, the params tensor layout for cudnn_lstm is so different from canonical LSTM,
we need a complete different set of init_scale and learning rate parameters.
rnn_mode == BLOCK
| config | epochs | train | valid | test | wps
| small | 13 | 40.55 | 120.70 | 115.52 | 17.2k
| medium | 39 | 45.68 | 86.97 | 83.47 | 13.6k
| large | 55 | 37.94 | 82.75 | 78.49 | 5.0k
Wps before this cl for small, medium, large models are
15.6k, 12.6k, and 5.0k, respectively.
Benchmarking platform: E5-2690 v4, Titan X.