Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.FormatException: Tensorflow exception triggered while loading model. #4449

Open
benquan opened this issue Nov 7, 2019 · 2 comments
Labels
bug

Comments

@benquan
Copy link

@benquan benquan commented Nov 7, 2019

System information

  • OS version/distro:
    Win10
  • .NET Version (eg., dotnet --info):
    .net core

Issue

I upgraded from ML.NET 1.3.1 to 1.4.0. Everything worked fine in 1.3.1 but after upgrading I get the following error:

System.FormatException: Tensorflow exception triggered while loading model. ---> System.DllNotFoundException: Unable to load DLL 'tensorflow' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at Tensorflow.c_api.TF_NewGraph()
   at Tensorflow.Graph..ctor()
   at Microsoft.ML.TensorFlow.TensorFlowUtils.LoadTFSessionByModelFilePath(IExceptionContext ectx, String modelFile, Boolean metaGraph)
   --- End of inner exception stack trace ---
   at Microsoft.ML.TensorFlow.TensorFlowUtils.LoadTFSessionByModelFilePath(IExceptionContext ectx, String modelFile, Boolean metaGraph)
   at Microsoft.ML.TensorflowCatalog.LoadTensorFlowModel(ModelOperationsCatalog catalog, String modelLocation)
   at ImageClassification.ModelScorer.TFModelScorer.LoadModel(String dataLocation, String imagesFolder, String modelLocation) in \\Mac\Home\Downloads\QuickID-netcore-sample\ImageClassification\ModelScorer\TFModelScorer.cs:line 94
   at ImageClassification.ModelScorer.TFModelScorer.Score() in \\Mac\Home\Downloads\QuickID-netcore-sample\ImageClassification\ModelScorer\TFModelScorer.cs:line 80
   at ImageClassification.Program.Main(String[] args) in \\Mac\Home\Downloads\QuickID-netcore-sample\ImageClassification\Program.cs:line 22
  • What did you do?
    upgraded from ML.NET 1.3.1 to 1.4.0
  • What happened?
    Error
  • What did you expect?
    The program ran just fine before

Source code / logs

Please paste or attach the code or logs or traces that would be helpful to diagnose the issue you are reporting.

@gvashishtha gvashishtha added the bug label Nov 7, 2019
@eerhardt

This comment has been minimized.

Copy link
Member

@eerhardt eerhardt commented Nov 8, 2019

In 1.3.1, Microsoft.ML.TensorFlow implicitly referenced the CPU version of TensorFlow. This caused issues when you wanted to use GPU packages instead.

So starting with 1.4.0, we removed the implicit reference to the CPU package, and now it is up to the application to pick which they'd like - CPU or GPU. So please add one of the following packages in your project:

  • CPU - SciSharp.TensorFlow.Redist
  • GPU -
    • SciSharp.TensorFlow.Redist-Windows-GPU
    • SciSharp.TensorFlow.Redist-Linux-GPU

@codemzs - did we put this breaking change in the release notes?

@benquan

This comment has been minimized.

Copy link
Author

@benquan benquan commented Nov 9, 2019

Thanks a lot. It started working on the self contained app. But now I am getting the same error when I try to convert that same app to a DLL and try access it as an external dependency from a different APP. Any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.