Skip to content

How can I remove Horovod ops from the savedModel to use with TF Serving? #467

Description

@alykhantejani

Title basically says it, I have trained a model using HorovodAllToAllEmbeddings and saved by doingg:


    de.keras.models.de_save_model(
        model,
        export_dir,
        overwrite=True,
        include_optimizer=False,
        options=save_options,
        signatures={
            "serving_default": model.get_tf_examples_serving_signature(
                feature_config,
                integrate_transform_layer=True,
                rename_serving_feature_names=rename_serving_feature_names,
            ),
            "serving_common_feature": model.get_tf_examples_serving_signature(
                feature_config,
                parse_sequence_example=True,
                integrate_transform_layer=True,
                rename_serving_feature_names=rename_serving_feature_names,
            ),
            "vanilla_serving": model.get_tf_examples_serving_signature(
                feature_config,
                integrate_transform_layer=False,
                rename_serving_feature_names=rename_serving_feature_names,
            ).get_concrete_function(*args, **kwargs),
        },
    )
    
   if hvd.rank() == 0:
       tf_save.save_and_return_nodes(
              obj=export_model,
              export_dir=export_dir,
              options=save_options,
              experimental_skip_checkpoint=True,
              signatures={
                  "serving_default": export_model.get_tf_examples_serving_signature(
                      feature_config,
                      parse_sequence_example=False,
                      integrate_transform_layer=True,
                      rename_serving_feature_names=rename_serving_feature_names,
                  ),
                  "serving_common_feature": export_model.get_tf_examples_serving_signature(
                      feature_config,
                      parse_sequence_example=True,
                      integrate_transform_layer=True,
                      rename_serving_feature_names=rename_serving_feature_names,
                  ),
                  "vanilla_serving": export_model.get_tf_examples_serving_signature(
                      feature_config,
                      integrate_transform_layer=False,
                      rename_serving_feature_names=rename_serving_feature_names,
                  ).get_concrete_function(*args, **kwargs),
              },
          )
          
          ```
          
          But I still end up with HorovodAlltoAll ops in the savedModel graph (which cant run at inference)

Activity

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