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 91 forks source link

An unhandled exception of type 'System.NotSupportedException' occurred in System.Numerics.Vectors.dll #14

Closed My-Khan closed 8 years ago

My-Khan commented 8 years ago

Hello, First i really appreciate your work. My programming skills in C# is not good therefore apology in advance if question seems to your good-self stupid. when i copile the source i got the error in ModelSetting .cs System.NotSupportedException was unhandled HResult=-2146233067 Message=Vector.Count cannot be called via reflection when intrinsics are enabled. Source=System.Numerics.Vectors StackTrace: at System.Numerics.Vector`1.get_Count() at RNNSharp.ModelSetting.DumpSetting() in D:\RNNSharp-master\RNNSharp\ModelSetting.cs:line 51 at RNNSharpConsole.Program.Train() in D:\RNNSharp-master\RNNSharpConsole\Program.cs:line 444 at RNNSharpConsole.Program.Main(String[] args) in D:\RNNSharp-master\RNNSharpConsole\Program.cs:line 277 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: here is my screen shoot: image

so please help , i am new to C# and my work is pending since two days due to this bug. thanks

bratao commented 8 years ago

Are you compiling it as "Debug" ? It seems to be a known bug in Debug mode (https://social.msdn.microsoft.com/Forums/vstudio/en-US/fd0a9ecc-b122-4795-a0e0-1cb6dc7a1a4a/anyone-got-simd-working-in-vs2015-net-46?forum=csharpgeneral)

My-Khan commented 8 years ago

Yes brataoi am compiling it in "Debug" mode

My-Khan commented 8 years ago

@bratao i followed your mentioned link, where i found that it is still unsolved issue. am i right?

zhongkaifu commented 8 years ago

@My-Khan Did you try to run it "Release" mode ? RNNSharp uses this Vector lib to speed up encoding and decoding by SIMD instruction. As far as I know, if your CPU doesn't support AVX2 instruction, it will throw out an exception in "debug" mode.

I'm thinking about adding a compiling definition, such as _SUPPORTSIMD, for the machine that doesn't support AVX2, but currently, I'm focusing on deep recurrent neural netowork for RNNSharp, so this fixing will be implemented later.

My-Khan commented 8 years ago

many thanks sir for your kind reply. Now as per your kind suggestions i run it in release mode and got the following error message. An unhandled exception of type 'System.Exception' occurred in RNNSharp.dll

Additional information: The offset of run time feature should be negative. screen shots of my error are below.

image

image

zhongkaifu commented 8 years ago

Could you please share your configuration file ? It seems incorrect settings in real time feature.

My-Khan commented 8 years ago

Sir, below is my configuration file contents

Template Features

TFEATURE_FILENAME:tfeature

Context Features

TFEATURE_CONTEXT:-2,-1,0,1,2

The context range for word embedding. In below, the context is current token, previous token and next token

The word embedding data file name generated by WSDSharp

WORDEMBEDDING_FILENAME:myvector WORDEMBEDDING_CONTEXT: -1,0,1

The column index applied word embedding feature

WORDEMBEDDING_COLUMN: 0

The run time feature

RTFEATURE_CONTEXT: 0

zhongkaifu commented 8 years ago

RTFEATURE_CONTEXT value should be negative( < 0), since RNNSharp uses previous tokens' outputs as run time features for current token.

In addition, this feature is only for forward neural network so far, bi-directional RNN doesn't support it.

My-Khan commented 8 years ago

Well sir the previous issue resolved, but a new issue generated, please also look this one, thanks in advance. this time it does not recognize the mapping tags. My training data is organized as, first column represent token,2nd column represents part of speech tag and last column represents label. Below is the error message: An unhandled exception of type 'System.DataMisalignedException' occurred in RNNSharp.dll

Additional information: Error: tag B_LOCATION is unknown. Tokens list: SentBE

contents of my mapfile are 00 O 01 S_PERSON 02 B_PERSON 03 M_PERSON 04 E_PERSON 05 S_LOCATION 06 B_LOCATION 07 M_LOCATION 08 E_LOCATION 09 S_ORGANIZATION 10 B_ORGANIZATION 11 M_ORGANIZATION 12 E_ORGANIZATION 13 S_DESIGNATION 14 B_DESIGNATION 15 M_DESIGNATION 16 E_DESIGNATION

zhongkaifu commented 8 years ago

The tag file format has been updated. Each line is one tag, so you could remove id from the file and then try it again.

My-Khan commented 8 years ago

Well done sir, now it works.... one last query: i am still confused about validation file data. what will be the validation file data?

  1. are it is the same data that is already exists in training file? OR
  2. are it is the same data that will be used in testing phase?
  3. are it is the totally separate portion of data that is neither used in training nor in testing, if Yes that what will be the proportion? Thanks , looking for your kind reply
zhongkaifu commented 8 years ago

Validation set is usually used to choose best hyper-parameter. It should not be mixed with either training corpus or test corpus. For entire training set, you could randomly sample 20% data as validation set in each iteration.

One suggestion: For other questions unrelated to title, it would be better to open a new thread about it.

My-Khan commented 8 years ago

Many thanks for very clear answer. i will try of my level best to follow your given suggestion in future. Looking forward for your next deep recurrent neural netowork for RNNSharp.