SciSharp / SciSharp-Stack-Examples

Practical examples written in SciSharp's machine learning libraries
http://scisharpstack.org
Apache License 2.0
313 stars 100 forks source link

TrainableVariables missing in NuGet-packages - not able to run example using NuGet-packages, only by compiling full source #71

Closed Darlanio closed 1 year ago

Darlanio commented 1 year ago

See public github repository for example: https://github.com/Darlanio/SciSharp_TensorFlowNet_Missing_TrainableVariables

I was able to compile the SciSharp-Stack-Examples and run the GAN-example without too much trouble, by incorporating all necessary repositories from SciSharp into the same solution.

However, using the NuGet packages, the TrainableVariables referred to on lines 163-167 in the file https://github.com/SciSharp/SciSharp-Stack-Examples/blob/master/src/TensorFlowNET.Examples/GAN/MnistGAN.cs will not be found.

One other thing that is missing is the ToBitmap() in NDArray, line 227. I wrote another SaveImage() to bypass this problem.

Since the TrainableVariables are available in the SciSharp-repositories, I guess this will be fixed with the next version of the NuGet-packages?

Oceania2018 commented 1 year ago

Just updated. Try to upgrade.

Darlanio commented 1 year ago

There seems to be something wrong still with the nuget packages. I upgraded to SciSharp.Tensorflow.Redist-Windows-GPU 2.10.0 TensorFlow.Keras 0.10.0 TensorFlow.NET 0.100.0

and use the code from the example MnistGAN.cs

All code compiles and run without error, but no improvement is visible in the output, while the same MnistGAN.cs file with only minor modifications shows clear improvements for each epoch.

I will post my code later this week in case there is something wrong there, but this is an indication that there might be something wrong. Do anyone else notice anything?

Darlanio commented 1 year ago

Updated nugets, but example still not working. Maybe I have done something wrong?

https://github.com/Darlanio/TensorFlowNetUpdatedGAN

I have now tried it both on CPU and GPU on two different computers. When using the full set of repositories from SciSharp, the code in the example (MnistGAN.cs) works just fine. When using it with the nuget-packages, it is not improving - code runs but without learning to generate any written figures.

Darlanio commented 1 year ago

AboveWithNuGetPackagesBelowWithSourceCompiledRepositories

Above is the non-existing progress when using NuGet Packages - might be a bug in my code that is available at https://github.com/Darlanio/TensorFlowNetUpdatedGAN

Below is the progress using code compiled from SciSharp repositories. It works just fine with that code. Not sure what is the difference.

Darlanio commented 1 year ago

Maybe I should open a new ticket/issue?

Darlanio commented 1 year ago

Only a few rows of code are different: image

Darlanio commented 1 year ago

I will let this remain closed and create a new issue.

Darlanio commented 1 year ago

The error can be seen with

        Console.WriteLine("D:" + D.TrainableVariables.Count());
        Console.WriteLine("G:" + G.TrainableVariables.Count());

D reports 12 G reports 8 with SciSharp-repositories, but 0 with NuGets.