Skip to content

Commit

Permalink
respond to nits
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
  • Loading branch information
kylesayrs committed Dec 6, 2024
1 parent e3c3f95 commit 81a1eab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/compressed_tensors/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import warnings
from functools import wraps
from typing import Any, Callable, Dict, Optional

import torch
Expand Down Expand Up @@ -174,6 +175,7 @@ def decorator(func: Callable[[Any], Any]):
if future_name is not None:
message += f". Please use {future_name} instead."

@wraps(func)
def wrapped(*args, **kwargs):
warnings.warn(message, DeprecationWarning, stacklevel=2)
return func(*args, **kwargs)
Expand Down
10 changes: 8 additions & 2 deletions src/compressed_tensors/utils/offload.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from functools import wraps
from typing import Any, Callable, Optional

import torch
Expand Down Expand Up @@ -47,7 +48,12 @@
def check_accelerate(fallback: Any):
def decorator(func: Callable[[Any], Any]):
if not _has_accelerate:
return lambda *args, **kwargs: fallback

@wraps(func)
def fallback_fn(*args, **kwargs):
return fallback

return fallback_fn

return func

Expand Down Expand Up @@ -193,7 +199,7 @@ def update_offload_data(

def delete_offload_parameter(module: torch.nn.Module, name: str):
"""
Delete a module from a module which may be offloaded
Delete a parameter from a module which may be offloaded
:param module: maybe offloaded module
:param name: name of parameter being deleted
Expand Down

0 comments on commit 81a1eab

Please sign in to comment.