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

Add graph mode to embedding models which benefits from ipex optimize #359

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

devpramod
Copy link

Graph mode (torchscript) is an additional step that can further accelerate a workload that has been optimized with ipex and bfloat16 along with mixed precision. Graph mode utilizes AMX on SPR for additional speedups.

This PR modifies config file to have graphmode as an option to end users
The graph is compiled in the constructor of the embedding module such that it is ready for execution when requests arrive.

Copy link
Collaborator

@gkumbhat gkumbhat 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 the contribution @devpramod ...

Couple of small housekeeping related comments for the PR:

  1. Can you rebase the PR with a sign-off, this allows github to verify and the DCO check would pass.
  2. It seems the lint and formatting checks are failing. Can you please address those.

Guidelines for contribution documenting some of these steps can be found here: https://github.com/caikit/caikit-nlp/blob/main/CONTRIBUTING.md

On the graphmode integration, couple of question and suggestions:

  1. When should the graph model be enabled? Can you add describe a bit when it is applicable, for which models etc ?
  2. How much of speedup is expected with enablement of graphmode ? Can you share some results ?

@devpramod
Copy link
Author

Hi @gkumbhat

  1. Enabling graph mode is most applicable for models that need high performance and efficiency in production. A wide range of PyTorch operations are covered in TorchScript's graph mode. It is not recommended in cases where there might be complex post processing involving custom python libraries as part of the model code.

  2. The speedups are dependent on the workload at hand. More information can be found here - https://pytorch.org/blog/optimizing-production-pytorch-performance-with-graph-transformations/
    On Intel hardware, using torchscript along with ipex optimize uses AMX an ISA with instructions to speed up AI workloads.

working on addressing 1 & 2

Signed-off-by: devpramod <pramod.pai@intel.com>
Signed-off-by: devpramod <pramod.pai@intel.com>
Signed-off-by: devpramod <pramod.pai@intel.com>
@devpramod
Copy link
Author

Hi @gkumbhat
I have resolved the formatting, linting and DCO check issues

Signed-off-by: devpramod <pramod.pai@intel.com>
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.

None yet

2 participants