eabdullin / Word2Vec.Net

implementation Word2Vec for .Net framework
Other
124 stars 41 forks source link

[Question]How to load GoogleNews-vectors-negative300.bin? #12

Open JieZou1 opened 7 years ago

JieZou1 commented 7 years ago

Hi,

I am trying to load the default model, GoogleNews-vectors-negative300.bin.

I have been using the following simple codes,

Word2Vec.Net.Distance distance = new Word2Vec.Net.Distance("GoogleNews-vectors-negative300.bin");

But, I received the following error message:

System.OutOfMemoryException: Array dimensions exceeded supported range.

Any ideas? Many Thanks. Jie

GuntaButya commented 7 years ago

2GB is the max Memory Size for an Object, you will need to split the Dataset, or use a smaller one. See: http://stackoverflow.com/questions/982051/net-max-memory-use-2gb-even-for-x64-assemblies

long memory = GC.GetTotalMemory(false); // Load your DataSet... Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "Corpus Memory Use: {0:0.0} G-bytes", ((Convert.ToDouble(totalMem) / 1024.0) / 1024.0) / 1024.0));