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

Temporarily fix ONNX model exporting error #21830

Merged
Merged
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
5 changes: 2 additions & 3 deletions src/transformers/models/swin2sr/modeling_swin2sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,8 @@ def set_shift_and_window_size(self, input_resolution):
if isinstance(self.shift_size, collections.abc.Iterable)
else (self.shift_size, self.shift_size)
)
self.window_size = (
input_resolution[0] if input_resolution[0] <= target_window_size[0] else target_window_size[0]
)
window_dim = input_resolution[0].item() if torch.is_tensor(input_resolution[0]) else input_resolution[0]
self.window_size = window_dim if window_dim <= target_window_size[0] else target_window_size[0]
self.shift_size = (
0
if input_resolution
Expand Down
5 changes: 2 additions & 3 deletions src/transformers/models/swinv2/modeling_swinv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,8 @@ def set_shift_and_window_size(self, input_resolution):
if isinstance(self.shift_size, collections.abc.Iterable)
else (self.shift_size, self.shift_size)
)
self.window_size = (
input_resolution[0] if input_resolution[0] <= target_window_size[0] else target_window_size[0]
)
window_dim = input_resolution[0].item() if torch.is_tensor(input_resolution[0]) else input_resolution[0]
self.window_size = window_dim if window_dim <= target_window_size[0] else target_window_size[0]
self.shift_size = (
0
if input_resolution
Expand Down