diff --git a/.gitmodules b/.gitmodules index bf1b51ab..3cd33570 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "codes/models/flownet2"] path = codes/models/flownet2 url = https://github.com/NVIDIA/flownet2-pytorch.git +[submodule "codes/switched_conv"] + path = codes/switched_conv + url = https://github.com/neonbjb/SwitchedConvolutions.git diff --git a/codes/data_scripts/use_discriminator_as_filter.py b/codes/data_scripts/use_discriminator_as_filter.py index 89df1344..078641a8 100644 --- a/codes/data_scripts/use_discriminator_as_filter.py +++ b/codes/data_scripts/use_discriminator_as_filter.py @@ -9,8 +9,8 @@ import options.options as option import utils.util as util from data.util import bgr2ycbcr import models.archs.SwitchedResidualGenerator_arch as srg -from switched_conv_util import save_attention_to_image, save_attention_to_image_rgb -from switched_conv import compute_attention_specificity +from switched_conv.switched_conv_util import save_attention_to_image, save_attention_to_image_rgb +from switched_conv.switched_conv import compute_attention_specificity from data import create_dataset, create_dataloader from models import create_model from tqdm import tqdm diff --git a/codes/models/ExtensibleTrainer.py b/codes/models/ExtensibleTrainer.py index 02e669b1..4f2b7636 100644 --- a/codes/models/ExtensibleTrainer.py +++ b/codes/models/ExtensibleTrainer.py @@ -109,7 +109,7 @@ class ExtensibleTrainer(BaseModel): if opt['dist']: dnet = DistributedDataParallel(anet, device_ids=[torch.cuda.current_device()], - find_unused_parameters=True) + find_unused_parameters=False) else: dnet = DataParallel(anet) if self.is_train: diff --git a/codes/models/archs/ProgressiveSrg_arch.py b/codes/models/archs/ProgressiveSrg_arch.py index 59988dda..f2ff9441 100644 --- a/codes/models/archs/ProgressiveSrg_arch.py +++ b/codes/models/archs/ProgressiveSrg_arch.py @@ -1,8 +1,8 @@ import models.archs.SwitchedResidualGenerator_arch as srg import torch import torch.nn as nn -from switched_conv_util import save_attention_to_image -from switched_conv import compute_attention_specificity +from switched_conv.switched_conv_util import save_attention_to_image +from switched_conv.switched_conv import compute_attention_specificity from models.archs.arch_util import ConvGnLelu, ExpansionBlock, MultiConvBlock import functools import torch.nn.functional as F diff --git a/codes/models/archs/SPSR_arch.py b/codes/models/archs/SPSR_arch.py index 89ddb060..26240514 100644 --- a/codes/models/archs/SPSR_arch.py +++ b/codes/models/archs/SPSR_arch.py @@ -12,8 +12,8 @@ from models.archs import SPSR_util as B from models.archs.SwitchedResidualGenerator_arch import ConfigurableSwitchComputer, ReferenceImageBranch, \ QueryKeyMultiplexer, QueryKeyPyramidMultiplexer from models.archs.arch_util import ConvGnLelu, UpconvBlock, MultiConvBlock, ReferenceJoinBlock -from switched_conv import compute_attention_specificity -from switched_conv_util import save_attention_to_image_rgb +from switched_conv.switched_conv import compute_attention_specificity +from switched_conv.switched_conv_util import save_attention_to_image_rgb from .RRDBNet_arch import RRDB diff --git a/codes/models/archs/StructuredSwitchedGenerator.py b/codes/models/archs/StructuredSwitchedGenerator.py index d8e7d638..6533719a 100644 --- a/codes/models/archs/StructuredSwitchedGenerator.py +++ b/codes/models/archs/StructuredSwitchedGenerator.py @@ -6,8 +6,8 @@ from models.archs.SPSR_arch import ImageGradientNoPadding from torch import nn import torch import torch.nn.functional as F -from switched_conv_util import save_attention_to_image_rgb -from switched_conv import compute_attention_specificity +from switched_conv.switched_conv_util import save_attention_to_image_rgb +from switched_conv.switched_conv import compute_attention_specificity import os import torchvision from torch.utils.checkpoint import checkpoint diff --git a/codes/models/archs/SwitchedResidualGenerator_arch.py b/codes/models/archs/SwitchedResidualGenerator_arch.py index 99145063..e2345912 100644 --- a/codes/models/archs/SwitchedResidualGenerator_arch.py +++ b/codes/models/archs/SwitchedResidualGenerator_arch.py @@ -1,11 +1,11 @@ import torch from torch import nn -from switched_conv import BareConvSwitch, compute_attention_specificity, AttentionNorm +from switched_conv.switched_conv import BareConvSwitch, compute_attention_specificity, AttentionNorm import torch.nn.functional as F import functools from collections import OrderedDict from models.archs.arch_util import ConvBnLelu, ConvGnSilu, ExpansionBlock, ExpansionBlock2, ConvGnLelu, MultiConvBlock, SiLU -from switched_conv_util import save_attention_to_image_rgb +from switched_conv.switched_conv_util import save_attention_to_image_rgb import os from models.archs.spinenet_arch import SpineNet diff --git a/codes/switched_conv b/codes/switched_conv new file mode 160000 index 00000000..b69d0317 --- /dev/null +++ b/codes/switched_conv @@ -0,0 +1 @@ +Subproject commit b69d031766e042d40ecd7dc4986422e77ab278cf diff --git a/codes/test.py b/codes/test.py index 2c272d1f..ffd8fa7e 100644 --- a/codes/test.py +++ b/codes/test.py @@ -9,8 +9,8 @@ import options.options as option import utils.util as util from data.util import bgr2ycbcr import models.archs.SwitchedResidualGenerator_arch as srg -from switched_conv_util import save_attention_to_image, save_attention_to_image_rgb -from switched_conv import compute_attention_specificity +from switched_conv.switched_conv_util import save_attention_to_image, save_attention_to_image_rgb +from switched_conv.switched_conv import compute_attention_specificity from data import create_dataset, create_dataloader from models import create_model from tqdm import tqdm