How to speedup rnn training speed of tensorflow?

后端 未结 2 1769
难免孤独
难免孤独 2021-02-09 04:52

Now base tensorflow-char-rnn I start a word-rnn project to predict the next word. But I found that speed is too slow in my train data set. Here is my training details:

相关标签:
2条回答
  • 2021-02-09 05:19

    As you mentionned batch_size is really important to tune, it can lead to impressive speedup but check that your perplexity keeps relevant.

    Monitoring your GPU activity can you give you hints about potential I/O bottleneck.

    Most importantly, using sampled softmax instead of regular softmax is way faster. This would require you to use a [config.vocab_size, config.hidden_size] weight matrix instead of you [config.hidden_size, config.vocab_size]. This is definitely the way to go to my point of view.

    Hope this helps.

    pltrdy

    0 讨论(0)
  • 2021-02-09 05:38

    One other possible way you can speed up training, and the possible reason for your lack of utilisation of the GPU, is you are using placeholders. You should be using queues, if using Tensorflow < 1.2, and the tf.contrib.data module otherwise.

    https://www.tensorflow.org/programmers_guide/threading_and_queues

    0 讨论(0)
提交回复
热议问题