tensor2tensor icon indicating copy to clipboard operation
tensor2tensor copied to clipboard

Slow lstm_seq2seq_attention training

Open fstahlberg opened this issue 9 years ago • 4 comments

I am trying to run the attention-based seq2seq baseline on wmt_ende_tokens_32k by just using

MODEL=lstm_seq2seq_attention HPARAMS=lstm_attention

in the walkthrough. However, training seems to be very slow: the global step/sec rate drops down to around 0.1 on a single K80, and the GPU utility is around 15%. Using a much smaller batch size by adding --hparams='batch_size=32' to the t2t-trainer command helps a bit but the GPU utility is still around 25%. Am I missing something? Thanks.

fstahlberg avatar Aug 03 '17 17:08 fstahlberg

I have similar issue, i am sure that my gpu is running but my cpu is also operating on 98%, i wonder if it is normal and it is taking ages as compared with transformer. For 101 steps lstm attention takes 5300s while transformer takes 16s, if this is normal then I am truly amazed at the time complexity of the transformer and lets not forget transformer is working with a batch size 4 times larger than lstm-attention.

colmantse avatar Aug 23 '17 14:08 colmantse

yes ,same to me, compared with transformer with 22 seconds for 100 steps, it took 600 seconds every 100 steps for lstm_attention

2877992943 avatar Aug 30 '17 08:08 2877992943

Can you check the latest version? It now uses the AttentionWrapper from seq2seq library which is much more optimized than the previous implementation. For the translate_ende_wmt_bpe32k task I'm getting ~5steps/s on a K80

kolloldas avatar Nov 03 '17 09:11 kolloldas

Thanks @kolloldas! Transformer will generally be faster. And hopefully the switch to the seq2seq libs will speed up the LSTM. Closing for now.

rsepassi avatar Nov 14 '17 00:11 rsepassi