A sequence input issue in the example of Sequence Classification
Hi,
I am playing with the example of Tests/EndToEndTests/Text/SequenceClassification/Config/seqcla.cntk. I modified the configuration file as follows:
// set up features and labels
t = DynamicAxis()
features = Input(383753, dynamicAxis=t)
labels = Input(numLabels)
// load the pre-learned word embedding matrix
l1 = Layers.EmbeddingLayer(features, vocab, embedDim, '383754_embedding.txt')
l2 = Layers.LSTMLayer(l1, embedDim, lstmDim, cellDim, BS.Sequences.Last)
l3 = Layers.DenseLayer(l2, lstmDim, numLabels, Pass)
out = Pass(l3, tag='output')
My input data looks like:
0 |x 8:1 |y 0:1
0 |x 9:1
0 |x 10:1
1 |x 956:1 |y 5:1
1 |x 957:1
1 |x 958:1
1 |x 961:1
2 |x 1097:1 |y 3:1
2 |x 1099:1
2 |x 1100:1
When I run cntk, it throws exception:
EXCEPTION occurred: Node 'l1.lookup' (GatherPacked operation) requires the first argument (index data) to be a scalar time sequence.
Is there any problem with my config file or data input? Thanks.
Can you try with using “SparseInput” instead of “Input”?
From: proteushf [mailto:[email protected]] Sent: Tuesday, July 19, 2016 03:03 AM To: Microsoft/CNTK [email protected] Subject: [Microsoft/CNTK] A sequence input issue in the example of Sequence Classification (#691)
Hi,
I am playing with the example of Tests/EndToEndTests/Text/SequenceClassification/Config/seqcla.cntk. I modified the configuration file as follows:
// set up features and labels
t = DynamicAxis()
features = Input(383753, dynamicAxis=t)
labels = Input(numLabels)
// load the pre-learned word embedding matrix
l1 = Layers.EmbeddingLayer(features, vocab, embedDim, '383754_embedding.txt')
l2 = Layers.LSTMLayer(l1, embedDim, lstmDim, cellDim, BS.Sequences.Last)
l3 = Layers.DenseLayer(l2, lstmDim, numLabels, Pass)
out = Pass(l3, tag='output')
My input data looks like:
0 |x 8:1 |y 0:1
0 |x 9:1
0 |x 10:1
1 |x 956:1 |y 5:1
1 |x 957:1
1 |x 958:1
1 |x 961:1
2 |x 1097:1 |y 3:1
2 |x 1099:1
2 |x 1100:1
When I run cntk, it throws exception:
EXCEPTION occurred: Node 'l1.lookup' (GatherPacked operation) requires the first argument (index data) to be a scalar time sequence.
Is there any problem with my config file or data input? Thanks.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/CNTK/issues/691, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALtRQYsFsyDm4bOLRNQXQJF4tHOZjkf1ks5qXCJFgaJpZM4JPR_-.
Thank you for the suggestion. I tried SparseInput, but it has the same error.
I tried some other ways and found the following change solves the problem: Input data format: 0 |x 8 |y 0:1 0 |x 9 0 |x 10 0 |x 11 In config file " features = Input(1, dynamicAxis=t)"