Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/transformers/core_model_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Chunk(ConversionOps):
def __init__(self, dim: int = 0):
self.dim = dim

@torch.no_grad
@torch.no_grad()
def convert(
self, input_dict: dict[str, torch.Tensor], source_patterns: list[str], target_patterns: list[str], **kwargs
) -> dict[str, torch.Tensor]:
Expand Down Expand Up @@ -134,7 +134,7 @@ class Concatenate(ConversionOps):
def __init__(self, dim: int = 0):
self.dim = dim

@torch.no_grad
@torch.no_grad()
def convert(
self,
input_dict: dict[str, list[torch.Tensor]],
Expand Down Expand Up @@ -175,7 +175,7 @@ class MergeModulelist(ConversionOps):
def __init__(self, dim: int = 0):
self.dim = dim

@torch.no_grad
@torch.no_grad()
def convert(
self,
input_dict: dict[str, list[torch.Tensor]],
Expand Down Expand Up @@ -211,7 +211,7 @@ class SplitModulelist(ConversionOps):
def __init__(self, dim: int = 0):
self.dim = dim

@torch.no_grad
@torch.no_grad()
def convert(
self, input_dict: dict[str, torch.Tensor], source_patterns: list[str], target_patterns: list[str], **kwargs
) -> dict[str, torch.Tensor]:
Expand Down Expand Up @@ -260,7 +260,7 @@ def _apply(self, tensor: torch.Tensor) -> torch.Tensor:
tensor = tensor.transpose(1, 2).reshape(dim1, dim2)
return tensor

@torch.no_grad
@torch.no_grad()
def convert(
self,
input_dict: dict[str, list[torch.Tensor]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def fail_all_requests(self, error: Exception) -> None:
self.scheduler.waiting_requests_order.clear()

@traced
@torch.no_grad
@torch.no_grad()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unsure about this one but I don't see a reason why we would not close here as well cc @remi-or

def _generation_step(self, model: nn.Module, logit_processor: LogitsProcessor, do_sample: bool) -> None:
"""Perform a single generation step."""

Expand Down