dasguptar / treelstm.pytorch

Tree LSTM implementation in PyTorch
MIT License
550 stars 139 forks source link

How to make it with dynamic batching? #6

Closed xuehy closed 7 years ago

xuehy commented 7 years ago

This implementation can only process one sample at a time. The performance is limited since the usage of the GPU is low. Is there possibility to make treelstm support dynamic batching such that the GPU can be fully utilized?

dasguptar commented 7 years ago

Hi @xuehy Extremely sorry for the late response! I somehow missed this issue. To answer your question, it will be non-trivial for me to support dynamic batching for tree-LSTMs. This type of model, i.e. a recursive neural network, will have a different structure for each input sample, and it is extremely difficult (almost impossible) to find samples which might result in almost similar structures, so that we can batch them together. However, all is not lost, as there are a few options that can be explored:

xuehy commented 7 years ago

Thanks for your detailed explanations! I am following SPINN's idea to make the network partially batched.