How to load a pushed_model from a different run and feed into Bulkinferrer

Hi there, I am tying to use make use of the Bulkinferrer by loading pushed_model from a different run/pipeline. Since they are from different runs, i cannot simply feed bulkinferrer with model = trainer.outputs['model'] .

I can find the pushed_model from the differnt pipeline, however, the pushed_model directly fetched from mlmd is of type ml_metadata.proto.metadata_store_pb2.Artifact , if i feed this into the Bulkinferrer i got Argument model should be a Channel of type <class 'tfx.types.standard_artifacts.Model'>.

My question is how can i make use of the mlmd metadata and load the pushed_model into the Bulkinferrer from a different run/pipeline?

Thanks a lot for your help.

Are you using the latest blessed model resolver to get the pushed model (saved_model)?

  # Get the latest blessed model for model validation.
  model_resolver = tfx.dsl.Resolver(
      strategy_class=tfx.dsl.experimental.LatestBlessedModelStrategy,
      model=tfx.dsl.Channel(type=tfx.types.standard_artifacts.Model),
      model_blessing=tfx.dsl.Channel(
          type=tfx.types.standard_artifacts.ModelBlessing)).with_id(
              'latest_blessed_model_resolver')
1 Like

Sorry for the late response, thank you Robert, the Resolver works very well now.

Happy to help, and glad that it’s working!