From 7755961321784ed9d704e894abb6830afab128f5 Mon Sep 17 00:00:00 2001 From: matt3o Date: Fri, 13 Oct 2023 12:12:10 +0200 Subject: [PATCH] fix #2 --- src/controlnet_aux/zoe/zoedepth/models/base_models/midas.py | 2 +- src/custom_midas_repo/midas/backbones/beit.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controlnet_aux/zoe/zoedepth/models/base_models/midas.py b/src/controlnet_aux/zoe/zoedepth/models/base_models/midas.py index 7d692d5..e04f81f 100644 --- a/src/controlnet_aux/zoe/zoedepth/models/base_models/midas.py +++ b/src/controlnet_aux/zoe/zoedepth/models/base_models/midas.py @@ -173,7 +173,7 @@ def get_size(self, width, height): def __call__(self, x): width, height = self.get_size(*x.shape[-2:][::-1]) - return nn.functional.interpolate(x, (height, width), mode='bilinear', align_corners=True) + return nn.functional.interpolate(x, (int(height), int(width)), mode='bilinear', align_corners=True) class PrepForMidas(object): def __init__(self, resize_mode="minimal", keep_aspect_ratio=True, img_size=384, do_resize=True): diff --git a/src/custom_midas_repo/midas/backbones/beit.py b/src/custom_midas_repo/midas/backbones/beit.py index 7a24e02..8f25dd1 100644 --- a/src/custom_midas_repo/midas/backbones/beit.py +++ b/src/custom_midas_repo/midas/backbones/beit.py @@ -44,7 +44,7 @@ def _get_rel_pos_bias(self, window_size): old_sub_table = old_relative_position_bias_table[:old_num_relative_distance - 3] old_sub_table = old_sub_table.reshape(1, old_width, old_height, -1).permute(0, 3, 1, 2) - new_sub_table = F.interpolate(old_sub_table, size=(new_height, new_width), mode="bilinear") + new_sub_table = F.interpolate(old_sub_table, size=(int(new_height), int(new_width)), mode="bilinear") new_sub_table = new_sub_table.permute(0, 2, 3, 1).reshape(new_num_relative_distance - 3, -1) new_relative_position_bias_table = torch.cat(