public void LoadVectors(string model_file)
{
var file = model_file;
using (var br = new BinaryReader(File.Open(file, FileMode.Open)))
{
wordCount = br.ReadInt32();
Dimensions = br.ReadInt32();
for (var w = 0; w < wordCount; w++)
{
var word = br.ReadString();
var vec = new float[Dimensions];
for (var d = 0; d < Dimensions; d++) vec[d] = br.ReadSingle();
Normalise(vec);
model[word] = vec;
}
}
}
I am calling this function in this function
private static void Train()
{
// Train vector model and save to file.
var word2vec = new Word2Vec();
word2vec.Train("corpus.txt", "model.bin");
}
where corpus.txt
is something that I already trained and doesn't matter in this question, and model.bin
is something that I need to read.
But when I call this, it gives me an UnauthorizedAccessException
at 'C:\\Program Files (x86)\\LINQPad5\\model.bin'
and this is not the right location for model.bin
When I try to put the absolute location of model.bin
by doing
word2vec.Train("corpus.txt", @"D:\Users\user\Documents\Visual Studio 2017\Projects\word2VecTest\word2VecTest\bin\Debug\model.bin");
It gives me the same error.
How can I set this location to work in LINQPad??
Try to run your program as admin. this could be your solution.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.