Closed rangwani-harsh closed 5 years ago
What's the motivation for this? You can already use something like a bag of words encoder, or some other kind of pooling, on top of any seq2seq encoder. I'm not sure what you're hoping to accomplish with what you're suggesting.
As allennlp has implementations for stacked LSTM with highway etc. which in a way are similar to LSTM. I want to use them as a Seq2Vec encoder opposed to using them as a Seq2Seq Encoder. As this code does the same thing i.e. to generate a vector from the hidden state and the time distributed state and was implemented for the pytorch RNN and LSTM units. I thought it shouldn't be hard to modify and make the code worked for stacked versions too.
There is a paper which uses this kind of seq2vec encoding http://aclweb.org/anthology/S18-1006 and achieves good results.
I am not sure if this is what you want but in case you are looking for a way to extract final hidden states of a Seq2SeqEncoder
output, get_final_encoder_states
function is what you need.
Thanks. This was what I was looking for. Although I do think that this information must be present on the seq2vec and seq2seq documentation page.
System (please complete the following information):
Question Hi team, Is there a way we could probably use this https://github.com/allenai/allennlp/blob/master/allennlp/modules/seq2vec_encoders/pytorch_seq2vec_wrapper.py to generate a vector for all seq2seq encoders available in allennlp?
Thanks