zhongkaifu / RNNSharp

RNNSharp is a toolkit of deep recurrent neural network which is widely used for many different kinds of tasks, such as sequence labeling, sequence-to-sequence and so on. It's written by C# language and based on .NET framework 4.6 or above versions. RNNSharp supports many different types of networks, such as forward and bi-directional network, sequence-to-sequence network, and different types of layers, such as LSTM, Softmax, sampled Softmax and others.
BSD 3-Clause "New" or "Revised" License
285 stars 92 forks source link

Crash during Tagging when using word embedding #13

Closed bratao closed 8 years ago

bratao commented 8 years ago

Hello again @zhongkaifu ,

Testing the latest version, after training, if I try to tag a file, I get the following crash:

Without WORDEMBEDDING_FILENAME , it works nice. The emmbed was created in Tex2Vec with the following command line: Txt2VecConsole.exe -mode train -trainfile corpus.txt -modelfile vector.bin -vocabfile vocab.txt -vector-size 200 -window 5 -min-count 1 -cbow 1 -threads 1 -iter 15

info,4/8/2016 12:58:28 AM Loading template feature set...
info,4/8/2016 12:58:28 AM Template feature size: 86693
info,4/8/2016 12:58:28 AM Template feature context size: 86693
info,4/8/2016 12:58:28 AM Get model type LSTM and direction FORWARD
info,4/8/2016 12:58:28 AM Model Structure: LSTM-RNN
info,4/8/2016 12:58:28 AM Loading LSTM-RNN model: E:\rnnsharp.model
info,4/8/2016 12:58:28 AM Loading input2hidden weights...
info,4/8/2016 12:58:28 AM Loading LSTM-Weight: width:200, height:86693, vqSize:0...
info,4/8/2016 12:58:30 AM Loading feature2hidden weights...
info,4/8/2016 12:58:30 AM Loading LSTM-Weight: width:200, height:200, vqSize:0...
info,4/8/2016 12:58:30 AM Loading hidden2output weights...
info,4/8/2016 12:58:30 AM Loading matrix. width: 200, height: 22, vqSize: 0
info,4/8/2016 12:58:30 AM CRF Model: False
Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at RNNSharp.SingleVector.get_Item(Int32 i) in C:\RNNSharp-master\RNNSharp\Vector.cs:line 107
   at RNNSharp.LSTMRNN.<>c__DisplayClass37_0.<computeHiddenLayer>b__0(Int32 j) in C:\RNNSharp-master\RNNSharp\LSTMRNN.cs:line 820
   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body)
   at RNNSharp.LSTMRNN.computeHiddenLayer(State state, Boolean isTrain) in C:\RNNSharp-master\RNNSharp\LSTMRNN.cs:line 869
   at RNNSharp.RNN.PredictSentence(Sequence pSequence, RunningMode runningMode) in C:\RNNSharp-master\RNNSharp\RNN.cs:line 277
   at RNNSharp.RNNDecoder.Process(Sentence sent) in C:\RNNSharp-master\RNNSharp\RNNDecoder.cs:line 77
   at RNNSharpConsole.Program.Test() in C:\RNNSharp-master\RNNSharpConsole\Program.cs:line 372
   at RNNSharpConsole.Program.Main(String[] args) in C:\RNNSharp-master\RNNSharpConsole\Program.cs:line 289

Process finished with exit code -1
zhongkaifu commented 8 years ago

Hi @bratao
From log, it seems word embedding context settings isn't loaded. could you please share configuration file ?

bratao commented 8 years ago

My bad, you´re right. I forgot to use the context setting in tagging !