-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[Misc] Use torch.compile for GemmaRMSNorm #7642
Conversation
👋 Hi! Thank you for contributing to the vLLM project. Once the PR is approved and ready to go, please make sure to run full CI as it is required to merge (or just use auto-merge). To run full CI, you can do one of these:
🚀 |
residual: Optional[torch.Tensor] = None, | ||
) -> Union[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]: | ||
"""PyTorch-native implementation equivalent to forward().""" | ||
return self.forward_static(self.weight.data, self.variance_epsilon, x, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even if this is a static function, I'm not sure this self
would cause problem here.
if you want to be safe, I think you can move this function outside of the class definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be ok since it does not touch the states under self
. I also checked that re-compilation does not happen after graph capturing, by monitoring the logs with TORCH_LOGS=guards
. Also, the ShareGPT throughput benchmark shows 10~15% improvements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as a temporary solution.
Signed-off-by: Alvant <alvasian@yandex.ru>
This PR is a temporary solution to accelerate Gemma models. The PR can be reverted once #7110 is merged.