CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

CSEvalClient problem

Open DeepLearningFanatic opened this issue 10 years ago • 8 comments

Hello:

I am trying to change around the CSEvalClient to test and see if it works with simple.cntk. got the following code:

using (var model = new IEvaluateModelManagedF()) { // Initialize model evaluator string config = GetFileContents( myPath to simple.cntk); Console.WriteLine(config); model.Init(config); }... I changed the String variables in the config to the right location, verified with Console.WriteLine( config) line, but Model.Init(config) throws the following Errors: Attempt to access invalid address. Attempt to access invalid address. Attempt to access invalid address. Microsoft::MSR::CNTK::GetEval The specified Module could not be found Has anyone encounter this issue. I was able to train using the CPUOnly binary, but cant make it work in c#.

Has anyone had this error and was able to fix it:

DeepLearningFanatic avatar Apr 16 '16 23:04 DeepLearningFanatic

simple.cntk is really exist by config path?

ghost avatar Apr 17 '16 05:04 ghost

It does exists, the GetFileContents() method returns the string of the Content of the cntk file on config variable, which I can see it. I think the problem may be in the locations of the data, config, output folders, specified in the simple.cntk file. What would be the value of the RootDir variable? I see RootDir = "..". I wonder which Directory would that be when loaded in VS 2013?

DeepLearningFanatic avatar Apr 17 '16 15:04 DeepLearningFanatic

I think you need to set the environment's dir. such as that, if you may check whether the current folder is correctly, you may need to set the "Environment.CurrentDirectory" also to the data folder.

such as bellow code line, Environment.CurrentDirectory = Path.Combine(initialDirectory, @"..\..\Examples\Image\MNIST\Data\");

We set the current directory to the ~\Examples\Image\MNIST\Data\ .( only if you run the CSEvalClient directly and does not modify the directorys of the CNTK repo).

BorisJineman avatar Apr 18 '16 06:04 BorisJineman

Hello Boris, Thank you for your prompt response:

I understood your explanation, However, I still have a problem with CSEvalClient project. Now, this is the Actual error I am Getting. image

I think this may be a bug I am getting, the reason being that when I run the cntk confiFile=simple.cntk, it runs smoothly... image

Now, I know that my configuration file is being accessed by CSEvalClient because I can see it, when I apply the text visualizer to the Config variable. I also Know that the Configuration File simple.cntk does not have any errors, since it works outside of VS 2013. So I was wondering if this is a bug, maybe someone else is having this error, or is it just me being unlucky, and my PC has one of those not supported configurations( I have a Laptop Samsung with intel core i7). Of Note: The CSEvalClient i am using is unchanged, except for the string to my simple.cntk file.

DeepLearningFanatic avatar Apr 19 '16 00:04 DeepLearningFanatic

@DeepLearningFanatic: I am not quite certain what your modifications are, but I was able to run the Simple.cntk using the EvaluateModelMultipleLayers method. ` private static void EvaluateModelMultipleLayers() { try { Environment.CurrentDirectory = Path.Combine(initialDirectory, @"....\Examples\Other\Simple2d\Data");

            Dictionary<string, List<float>> outputs;

            using (var model = new IEvaluateModelManagedF())
            {
                // Initialize model evaluator
                string config = GetFileContents(Path.Combine(Environment.CurrentDirectory, @"..\Config\Simple.cntk"));
                model.Init(config);

                // Load model
                string modelFilePath = Path.Combine(Environment.CurrentDirectory, @"..\Output\Models\Simple.dnn");
                model.CreateNetwork(string.Format("deviceId=-1\nmodelPath=\"{0}\"", modelFilePath));

                // Generate random input values in the appropriate structure and size
                var inputs = GetDictionary("features", 2, 255);

                // We can preallocate the output structure and pass it in (multiple output layers)
                outputs = GetDictionary("ScaledLogLikelihood", 2, 1);

                model.Evaluate(inputs, outputs);
            }

            OutputResults(outputs);
        }

` What I changed:

  • The path to the Simple Data location
  • Retrieving the file contents of Simple.cntk
  • Specifying the correct model path for Simple.dnn (make sure the model actually exists)
  • Specifying the correct input layer (features) with a size 2
  • Specifying the correct output layer (ScaledLogLikelihood) with the appropriate size of 2

Best regards, Gaizka

image

gaizkan avatar Apr 19 '16 13:04 gaizkan

@gaizkan: one question, is your cntk the binaries from february, 2016? Or did you compile your own version of cntk?

DeepLearningFanatic avatar Apr 19 '16 17:04 DeepLearningFanatic

Ok, Here is how I got it to work: 1-) Re Compiled the most updated version of CNTK as release_CpuOnly x64, since, as of this date, the Binaries are from February 8, 2016. 2-) also made CSEvalClient release_CpuOnly x64.

This issue had been addressed before here: C# wrapper - unmatched bracket found in parameters #264

DeepLearningFanatic avatar Apr 20 '16 00:04 DeepLearningFanatic

@DeepLearningFanatic : I am glad to hear you were to run the sample again. As far as your question goes: I usually get the latest from source. I compiled and ran the Debug version. I will close this comment.

gaizkan avatar Apr 20 '16 06:04 gaizkan