Skip to content

Version 0.4.0 not loading models from S3 #429

Closed

Description

@dennisTS

Dear TF team,

we are experiencing a weird issue with the latest version of TensorFlow for Java - after upgrade it stopped loading models from S3.

Here's an example setup:

Java 8, a single dependency:

    <dependency>
      <groupId>org.tensorflow</groupId>
      <artifactId>tensorflow-core-platform</artifactId>
      <version>0.4.0</version>
    </dependency>

A single class:

import org.tensorflow.SavedModelBundle;

public class App {

  public static void main(String[] args) {
    SavedModelBundle.load("s3://some/location", "serve");
  }
}

Environment variable: AWS_REGION=eu-central-1

Outcome:

2022-03-09 20:53:24.893857: I external/org_tensorflow/tensorflow/cc/saved_model/reader.cc:43] Reading SavedModel from: s3://some/location
2022-03-09 20:53:24.893896: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:283] SavedModel load for tags { serve }; Status: fail: NOT_FOUND: Could not find SavedModel .pb or .pbtxt at supplied export directory path: s3://some/location. Took 49 microseconds.
Exception in thread "main" org.tensorflow.exceptions.TensorFlowException: Could not find SavedModel .pb or .pbtxt at supplied export directory path: s3://some/location
	at org.tensorflow.internal.c_api.AbstractTF_Status.throwExceptionIfNotOK(AbstractTF_Status.java:101)
	at org.tensorflow.SavedModelBundle.load(SavedModelBundle.java:623)
	at org.tensorflow.SavedModelBundle.access$000(SavedModelBundle.java:67)
	at org.tensorflow.SavedModelBundle$Loader.load(SavedModelBundle.java:97)
	at org.tensorflow.SavedModelBundle.load(SavedModelBundle.java:357)
	at App.main(App.java:6)

Either of the changes below "fixes" the issue:

  • changing from S3 to local
  • changing from 0.4.0 to 0.3.3

Question: has anything changed since the previous version? Are we missing some important point that would make integration with S3 possible?

Thank you!

Activity

  1. Craigacp commented on Mar 9, 2022

    @Craigacp
    Collaborator

    s3 support was removed from TF 2.6 (tensorflow/tensorflow#51583) and split out into a separate TF IO package (https://github.com/tensorflow/io). If you download the appropriate version of TF IO, extract the so/dylib files from it, you should be able to register the filesystem plugin with org.tensorflow.internal.c_api.global.tensorflow.TF_RegisterFilesystemPlugin(String plugin_filename, TF_Status status). We don't provide a wrapper around that method like we do for library loading, because we hadn't noticed that upstream TF had split out the filesystem support into a separate package. We'll put it on the todo list.

  2. dennisTS commented on Mar 10, 2022

    @dennisTS
    Author

    Understood, thanks for the clarification, @Craigacp !

  3. rhps commented on Mar 16, 2022

    @rhps

    Hi @Craigacp and @dennisTS, I have the same problem. Could you mind to share the solution? Since I have downloaded the newest version of TF IO and installed it correctly, but I still found that issue?

  4. Craigacp commented on Mar 16, 2022

    @Craigacp
    Collaborator

    You need to supply the path to libtensorflow_io_plugins.so which will have been installed into your python environment as an argument to the TF_RegisterFilesystemPlugin method that I mentioned above.

  5. Craigacp commented on Sep 23, 2022

    @Craigacp
    Collaborator

    In v0.4.2 we added a method which makes it easier to load the native filesystem libraries. You'll still need to download the python wheel and extract it, but at least it's easier to load on the Java side now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions