tfx icon indicating copy to clipboard operation
tfx copied to clipboard

`ImporterNode` to import `Model` artifact

Open sumitbinnani opened this issue 4 years ago • 3 comments

While using ImporterNode to specify Model artifact, the model needs to be placed under serving_model_dir within the source_uri. Using the actual model path, fails to recognize the model.

sumitbinnani avatar Aug 16 '21 22:08 sumitbinnani

@sumitbinnani , please provide a link or reference for the code snippet to help us expedite the debugging process.Thanks.

arghyaganguly avatar Aug 17 '21 14:08 arghyaganguly

Example: Let us assume that the model is stored at the path: some_path/serving_model_dir/{saved_model.pb, assets/, variables/}. Then to import the model, this is the expected intuitive behavior.

model = ImporterNode(
  instance_name='import_model',
  source_uri=''some_path/serving_model_dir",
  artifact_type=Model
)

pusher = Pusher(model=model,
  push_destination=pusher_pb2.PushDestination(
    filesystem=pusher_pb2.PushDestination.Filesystem(base_directory=output_dir)
  )
)

However, this fails as the Model artifact assumes that the model is stored within serving_model_dir.

The following snippet works, however, it might not be the best idea to assume that the model is always going to be wrapped within serving_model_dir within the provided path. If this is indeed an expected behavior and is a design choice, we need to update the docs.

model = ImporterNode(
  instance_name='import_model',
  source_uri=''some_path",
  artifact_type=Model
)

pusher = Pusher(model=model,
  push_destination=pusher_pb2.PushDestination(
    filesystem=pusher_pb2.PushDestination.Filesystem(base_directory=output_dir)
  )
)

sumitbinnani avatar Aug 20 '21 23:08 sumitbinnani

The importer assumes the input is in supported format, it won't change the format, just register that as an artifact of that type

1025KB avatar Sep 17 '21 03:09 1025KB

@sumitbinnani As mentioned above, please register that as an artifact of that type (in supported format). Closing this issue as it has been inactive for a long time.

gowthamkpr avatar Sep 29 '22 23:09 gowthamkpr

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Sep 29 '22 23:09 google-ml-butler[bot]