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

TorchServe linux-aarch64 experimental support #3071

Merged
merged 23 commits into from
May 3, 2024
Merged

Conversation

agunapal
Copy link
Collaborator

@agunapal agunapal commented Apr 3, 2024

Description

TorchServe on linux aarch64 - Experimental

Plan

TorchServe has been tested to be working on linux aarch64 for some of the examples. Regression tests have not been tested. Tested this on Amazon Graviton 3 instance(m7g.4x.large)

Installation

Currently installation from PyPi or installing from source works. Conda binaries will be available once this PR is pushed.

python ts_scripts/install_dependencies.py
pip install torchserve torch-model-archiver torch-workflow-archiver

Optimizations

You can also enable this optimizations for Graviton 3 to get an improved performance. More details can be found in this blog

export DNNL_DEFAULT_FPMATH_MODE=BF16
export LRU_CACHE_CAPACITY=1024

Example

This example on Text to Speech synthesis was verified to be working on Graviton 3

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Feature/Issue validation/testing

Please describe the Unit or Integration tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.

  • Test A
    Logs for Test A

  • Test B
    Logs for Test B

Checklist:

  • Did you have fun?
  • Have you added tests that prove your fix is effective or that this feature works?
  • Has code been commented, particularly in hard-to-understand areas?
  • Have you made corresponding changes to the documentation?

@agunapal agunapal mentioned this pull request Apr 3, 2024
4 tasks
@agunapal agunapal marked this pull request as ready for review April 4, 2024 21:41
@msaroufim
Copy link
Member

Any strategy for how we'll test this in CI? Cause if not might be best to mark this support as early preview or experimental with the expectation that some things might break

@agunapal
Copy link
Collaborator Author

agunapal commented Apr 5, 2024

Any strategy for how we'll test this in CI? Cause if not might be best to mark this support as early preview or experimental with the expectation that some things might break

Good point. I updated the plan to include what needs to be implemented for CI, regression #3072

Once we remove the dependency on TorchText, we'll know what else is remaining.

@agunapal agunapal changed the title TorchServe linux-aarch64 support TorchServe linux-aarch64 experimental support Apr 5, 2024
@agunapal
Copy link
Collaborator Author

agunapal commented Apr 5, 2024

Any strategy for how we'll test this in CI? Cause if not might be best to mark this support as early preview or experimental with the expectation that some things might break

@msaroufim Updated the documentation to say its experimental

Copy link
Contributor

@chauhang chauhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the SpeechT5 example for Graviton. It will be good to also include the new WavLLM model added to https://github.com/microsoft/SpeechT5/tree/main/WavLLM. For the WaveGlow example updates, please update the readme to indicate that example also works on Graviton instances and not just for Nvidia GPUs

docs/linux_aarch64.md Outdated Show resolved Hide resolved
)
return output

def postprocess(self, inference_output):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the response being sent to the client side? Will be good add support for streaming response, and the make the location of /tmp configurable in case the deployment server does not have "/tmp" folder

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, the output path can be set in model-config.yaml

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set the output_dir in config file

@@ -0,0 +1,48 @@
# Text to Speech synthesis with SpeechT5

This is an example showing text to speech synthesis using SpeechT5 model. This has been verified to work on (linux-aarch64) Graviton 3 instance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the Speech Synthesis example for Graviton. It will be good to also see if support for the new WavLLM in https://github.com/microsoft/SpeechT5/tree/main/WavLLM added to the Microsoft SpeechT5 can also be included.

@agunapal agunapal requested a review from lxning April 18, 2024 20:40
Comment on lines 4 to 7
model: "./model"
vocoder: "./vocoder"
processor: "./processor"
speaker_embeddings: "./speaker_embeddings"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dot can be removed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment on lines +31 to +33
self.processor = SpeechT5Processor.from_pretrained(processor)
self.model = SpeechT5ForTextToSpeech.from_pretrained(model)
self.vocoder = SpeechT5HifiGan.from_pretrained(vocoder)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without prefix model_dir, do these paths work correctly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated. They work

)
return output

def postprocess(self, inference_output):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, the output path can be set in model-config.yaml

@agunapal agunapal requested a review from lxning May 3, 2024 17:46
@lxning lxning added this pull request to the merge queue May 3, 2024
Merged via the queue into master with commit 5c1682a May 3, 2024
10 of 12 checks passed
@agunapal agunapal deleted the feature/aarch64_support branch May 3, 2024 22:19
@emmanuel-ferdman emmanuel-ferdman mentioned this pull request Sep 16, 2024
10 tasks
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

Successfully merging this pull request may close these issues.

4 participants