CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

How to read DSSM data

Open yaochengji opened this issue 10 years ago • 5 comments

Hi,

I want to build a LSTM-DSSM structure as in this paper. http://arxiv.org/abs/1502.06922

I have found that there is a DSSMReader class. But it doesn't read the length of the sentence.

In order to add the length information, is using MBLayoutPtr enough?

Thanks

yaochengji avatar Mar 23 '16 03:03 yaochengji

I tried to use MBLayout but now I am puzzled.

The DSSM data has two features: query and document. However, it seems that MBLayout can only be used to denote one's sequence length.

yaochengji avatar Mar 23 '16 14:03 yaochengji

Yes, this is a limitation of the current reader infrastructure. We are working very actively to remove this limitation.

There is a rather involved trick. You can use LMSequenceReader instead, encode document and query in a single sequence, and use the Gather() operation to split them into two separate sequences. Those can have different lengths that you can run LSTMs over separately. Then use another Gather() to pull out the last frame.

Gather() is an operation that drops frames from a sequence. It takes a data input and a flag input of the same length. Its output consists of the input sequence with all frames removed where the input flag is 0.

So your task now is to create a flag sequence that is all zeroes for the words of the document and all ones for the words of the query. You do that by separating doc and query by a separator symbol (e.g. SENT_END) and extracting a flag from the input that is 1 for this symbol (RowSlice (index_of_SENT_END, 1, input). Then build a left-to-right recurrent "network" that sums up this flag. Pass this to Gather() to extract the query, and pass 1-this to extract the document. Now you have two inputs of different lengths that CNTK's execution engine can handle just fine.

Use a similar trick to extract the final frames of the encoders.

frankseide avatar Mar 23 '16 17:03 frankseide

Hi, frankseide,

I meet the same issue too. But I am puzzled with the Operation of Gather and RowSlice. Can you share a simple case to use Gather and RowSlice?

Thanks.

1026112881 avatar Apr 05 '16 02:04 1026112881

Hi, is there a downloadable dataset for dssm?

edwardyoon avatar May 10 '16 06:05 edwardyoon

This has been dormant for a long time and I'm not sure if it is still relevant ... If you are still missing capabilities/functionality in the latest release, please open a new issue with a detailed requirement specification

wolfma61 avatar Jul 14 '17 11:07 wolfma61