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

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

Open
alykhantejani opened this issue Sep 19, 2024 · 2 comments

Comments

@alykhantejani
Copy link

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)
@alykhantejani
Copy link
Author

bots have hit github

@tensorflow tensorflow deleted a comment Nov 15, 2024
@MoFHeka
Copy link
Collaborator

MoFHeka commented Nov 16, 2024

According to the demo, rebuilding the model with mpi_rank=0 and mpi_size=1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants