From 552e70a032fb8f0e8b00d222ff780c037d233e33 Mon Sep 17 00:00:00 2001 From: James Betker Date: Sun, 18 Oct 2020 10:09:37 -0600 Subject: [PATCH] Get rid of excessive checkpointed disc params --- codes/models/archs/discriminator_vgg_arch.py | 58 ++++++++++---------- codes/models/steps/progressive_zoom.py | 4 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/codes/models/archs/discriminator_vgg_arch.py b/codes/models/archs/discriminator_vgg_arch.py index 7d56e889..3de79f0d 100644 --- a/codes/models/archs/discriminator_vgg_arch.py +++ b/codes/models/archs/discriminator_vgg_arch.py @@ -143,44 +143,44 @@ class Discriminator_VGG_128_GN_Checkpointed(nn.Module): def __init__(self, in_nc, nf, input_img_factor=1): super(Discriminator_VGG_128_GN_Checkpointed, self).__init__() # [64, 128, 128] - self.conv0_0 = nn.Conv2d(in_nc, nf, 3, 1, 1, bias=True) - self.conv0_1 = nn.Conv2d(nf, nf, 4, 2, 1, bias=False) - self.bn0_1 = nn.GroupNorm(8, nf, affine=True) + conv0_0 = nn.Conv2d(in_nc, nf, 3, 1, 1, bias=True) + conv0_1 = nn.Conv2d(nf, nf, 4, 2, 1, bias=False) + bn0_1 = nn.GroupNorm(8, nf, affine=True) # [64, 64, 64] - self.conv1_0 = nn.Conv2d(nf, nf * 2, 3, 1, 1, bias=False) - self.bn1_0 = nn.GroupNorm(8, nf * 2, affine=True) - self.conv1_1 = nn.Conv2d(nf * 2, nf * 2, 4, 2, 1, bias=False) - self.bn1_1 = nn.GroupNorm(8, nf * 2, affine=True) + conv1_0 = nn.Conv2d(nf, nf * 2, 3, 1, 1, bias=False) + bn1_0 = nn.GroupNorm(8, nf * 2, affine=True) + conv1_1 = nn.Conv2d(nf * 2, nf * 2, 4, 2, 1, bias=False) + bn1_1 = nn.GroupNorm(8, nf * 2, affine=True) # [128, 32, 32] - self.conv2_0 = nn.Conv2d(nf * 2, nf * 4, 3, 1, 1, bias=False) - self.bn2_0 = nn.GroupNorm(8, nf * 4, affine=True) - self.conv2_1 = nn.Conv2d(nf * 4, nf * 4, 4, 2, 1, bias=False) - self.bn2_1 = nn.GroupNorm(8, nf * 4, affine=True) + conv2_0 = nn.Conv2d(nf * 2, nf * 4, 3, 1, 1, bias=False) + bn2_0 = nn.GroupNorm(8, nf * 4, affine=True) + conv2_1 = nn.Conv2d(nf * 4, nf * 4, 4, 2, 1, bias=False) + bn2_1 = nn.GroupNorm(8, nf * 4, affine=True) # [256, 16, 16] - self.conv3_0 = nn.Conv2d(nf * 4, nf * 8, 3, 1, 1, bias=False) - self.bn3_0 = nn.GroupNorm(8, nf * 8, affine=True) - self.conv3_1 = nn.Conv2d(nf * 8, nf * 8, 4, 2, 1, bias=False) - self.bn3_1 = nn.GroupNorm(8, nf * 8, affine=True) + conv3_0 = nn.Conv2d(nf * 4, nf * 8, 3, 1, 1, bias=False) + bn3_0 = nn.GroupNorm(8, nf * 8, affine=True) + conv3_1 = nn.Conv2d(nf * 8, nf * 8, 4, 2, 1, bias=False) + bn3_1 = nn.GroupNorm(8, nf * 8, affine=True) # [512, 8, 8] - self.conv4_0 = nn.Conv2d(nf * 8, nf * 8, 3, 1, 1, bias=False) - self.bn4_0 = nn.GroupNorm(8, nf * 8, affine=True) - self.conv4_1 = nn.Conv2d(nf * 8, nf * 8, 4, 2, 1, bias=False) - self.bn4_1 = nn.GroupNorm(8, nf * 8, affine=True) + conv4_0 = nn.Conv2d(nf * 8, nf * 8, 3, 1, 1, bias=False) + bn4_0 = nn.GroupNorm(8, nf * 8, affine=True) + conv4_1 = nn.Conv2d(nf * 8, nf * 8, 4, 2, 1, bias=False) + bn4_1 = nn.GroupNorm(8, nf * 8, affine=True) final_nf = nf * 8 # activation function self.lrelu = nn.LeakyReLU(negative_slope=0.2, inplace=True) - self.body = nn.Sequential(self.conv0_0, self.lrelu, - self.conv0_1, self.bn0_1, self.lrelu, - self.conv1_0, self.bn1_0, self.lrelu, - self.conv1_1, self.bn1_1, self.lrelu, - self.conv2_0, self.bn2_0, self.lrelu, - self.conv2_1, self.bn2_1, self.lrelu, - self.conv3_0, self.bn3_0, self.lrelu, - self.conv3_1, self.bn3_1, self.lrelu, - self.conv4_0, self.bn4_0, self.lrelu, - self.conv4_1, self.bn4_1, self.lrelu) + self.body = nn.Sequential(conv0_0, self.lrelu, + conv0_1, bn0_1, self.lrelu, + conv1_0, bn1_0, self.lrelu, + conv1_1, bn1_1, self.lrelu, + conv2_0, bn2_0, self.lrelu, + conv2_1, bn2_1, self.lrelu, + conv3_0, bn3_0, self.lrelu, + conv3_1, bn3_1, self.lrelu, + conv4_0, bn4_0, self.lrelu, + conv4_1, bn4_1, self.lrelu) self.linear1 = nn.Linear(int(final_nf * 4 * input_img_factor * 4 * input_img_factor), 100) self.linear2 = nn.Linear(100, 1) diff --git a/codes/models/steps/progressive_zoom.py b/codes/models/steps/progressive_zoom.py index 98d7af7f..a648e235 100644 --- a/codes/models/steps/progressive_zoom.py +++ b/codes/models/steps/progressive_zoom.py @@ -67,10 +67,10 @@ class ProgressiveGeneratorInjector(Injector): if not isinstance(inputs, list): inputs = [inputs] if not isinstance(self.output, list): - self.output = [self.output] + output = [self.output] results = {} # A list of outputs produced by feeding each progressive lq input into the generator. results_hq = [] - for out_key in self.output: + for out_key in output: results[out_key] = [] b, f, h, w = lq_inputs[:, 0].shape