-
Notifications
You must be signed in to change notification settings - Fork 1.1k
bump version to 0.6.7 & fix api breaking changes #2832
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ | |
|
|
||
| import functools | ||
| import os | ||
| from typing import Optional | ||
| from typing import Optional, Union | ||
|
|
||
| import torch | ||
|
|
||
|
|
@@ -62,11 +62,19 @@ def get_norm_module(): | |
|
|
||
|
|
||
| def _normalize_scale_tensor( | ||
| scale: torch.Tensor, ref_tensor: torch.Tensor | ||
| scale: Union[float, torch.Tensor], ref_tensor: torch.Tensor | ||
| ) -> torch.Tensor: | ||
| """Normalize quantization scale tensor to 1D shape (1,) on target device.""" | ||
| """Normalize quantization scale to 1D tensor of shape (1,) on target device.""" | ||
| if not isinstance(scale, torch.Tensor): | ||
| raise TypeError(f"scale must be torch.Tensor, got {type(scale)}") | ||
| import warnings | ||
|
|
||
| warnings.warn( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this interface have to be stable version over version? Naively I would think that
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rmsnorm_quant and fused_add_rmsnorm_quant were the breaking changes (type changed). the compatibility fix landed in this helper function so both old and new signature are supported |
||
| "Passing scale as a float is deprecated and will be removed in a future " | ||
| "release. Use a torch.Tensor of shape (1,) instead.", | ||
| FutureWarning, | ||
| stacklevel=3, | ||
| ) | ||
| scale = torch.tensor([scale], dtype=torch.float32, device=ref_tensor.device) | ||
| if scale.device != ref_tensor.device: | ||
| scale = scale.to(ref_tensor.device) | ||
| if scale.dtype != torch.float32: | ||
|
|
@@ -159,7 +167,7 @@ def rmsnorm_quant( | |
| out: torch.Tensor, | ||
| input: torch.Tensor, | ||
| weight: torch.Tensor, | ||
| scale: torch.Tensor, | ||
| scale: Union[float, torch.Tensor], | ||
| eps: float = 1e-6, | ||
| enable_pdl: Optional[bool] = None, | ||
| ) -> None: | ||
|
|
@@ -268,7 +276,7 @@ def fused_add_rmsnorm_quant( | |
| input: torch.Tensor, | ||
| residual: torch.Tensor, | ||
| weight: torch.Tensor, | ||
| scale: torch.Tensor, | ||
| scale: Union[float, torch.Tensor], | ||
| eps: float = 1e-6, | ||
| enable_pdl: Optional[bool] = None, | ||
| ) -> None: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.