Get rid of excessive checkpointed disc params

This commit is contained in:
James Betker 2020-10-18 10:09:37 -06:00
parent 6a0d5f4813
commit 552e70a032
2 changed files with 31 additions and 31 deletions

View File

@ -143,44 +143,44 @@ class Discriminator_VGG_128_GN_Checkpointed(nn.Module):
def __init__(self, in_nc, nf, input_img_factor=1): def __init__(self, in_nc, nf, input_img_factor=1):
super(Discriminator_VGG_128_GN_Checkpointed, self).__init__() super(Discriminator_VGG_128_GN_Checkpointed, self).__init__()
# [64, 128, 128] # [64, 128, 128]
self.conv0_0 = nn.Conv2d(in_nc, nf, 3, 1, 1, bias=True) conv0_0 = nn.Conv2d(in_nc, nf, 3, 1, 1, bias=True)
self.conv0_1 = nn.Conv2d(nf, nf, 4, 2, 1, bias=False) conv0_1 = nn.Conv2d(nf, nf, 4, 2, 1, bias=False)
self.bn0_1 = nn.GroupNorm(8, nf, affine=True) bn0_1 = nn.GroupNorm(8, nf, affine=True)
# [64, 64, 64] # [64, 64, 64]
self.conv1_0 = nn.Conv2d(nf, nf * 2, 3, 1, 1, bias=False) conv1_0 = nn.Conv2d(nf, nf * 2, 3, 1, 1, bias=False)
self.bn1_0 = nn.GroupNorm(8, nf * 2, affine=True) bn1_0 = nn.GroupNorm(8, nf * 2, affine=True)
self.conv1_1 = nn.Conv2d(nf * 2, nf * 2, 4, 2, 1, bias=False) conv1_1 = nn.Conv2d(nf * 2, nf * 2, 4, 2, 1, bias=False)
self.bn1_1 = nn.GroupNorm(8, nf * 2, affine=True) bn1_1 = nn.GroupNorm(8, nf * 2, affine=True)
# [128, 32, 32] # [128, 32, 32]
self.conv2_0 = nn.Conv2d(nf * 2, nf * 4, 3, 1, 1, bias=False) conv2_0 = nn.Conv2d(nf * 2, nf * 4, 3, 1, 1, bias=False)
self.bn2_0 = nn.GroupNorm(8, nf * 4, affine=True) bn2_0 = nn.GroupNorm(8, nf * 4, affine=True)
self.conv2_1 = nn.Conv2d(nf * 4, nf * 4, 4, 2, 1, bias=False) conv2_1 = nn.Conv2d(nf * 4, nf * 4, 4, 2, 1, bias=False)
self.bn2_1 = nn.GroupNorm(8, nf * 4, affine=True) bn2_1 = nn.GroupNorm(8, nf * 4, affine=True)
# [256, 16, 16] # [256, 16, 16]
self.conv3_0 = nn.Conv2d(nf * 4, nf * 8, 3, 1, 1, bias=False) conv3_0 = nn.Conv2d(nf * 4, nf * 8, 3, 1, 1, bias=False)
self.bn3_0 = nn.GroupNorm(8, nf * 8, affine=True) bn3_0 = nn.GroupNorm(8, nf * 8, affine=True)
self.conv3_1 = nn.Conv2d(nf * 8, nf * 8, 4, 2, 1, bias=False) conv3_1 = nn.Conv2d(nf * 8, nf * 8, 4, 2, 1, bias=False)
self.bn3_1 = nn.GroupNorm(8, nf * 8, affine=True) bn3_1 = nn.GroupNorm(8, nf * 8, affine=True)
# [512, 8, 8] # [512, 8, 8]
self.conv4_0 = nn.Conv2d(nf * 8, nf * 8, 3, 1, 1, bias=False) conv4_0 = nn.Conv2d(nf * 8, nf * 8, 3, 1, 1, bias=False)
self.bn4_0 = nn.GroupNorm(8, nf * 8, affine=True) bn4_0 = nn.GroupNorm(8, nf * 8, affine=True)
self.conv4_1 = nn.Conv2d(nf * 8, nf * 8, 4, 2, 1, bias=False) conv4_1 = nn.Conv2d(nf * 8, nf * 8, 4, 2, 1, bias=False)
self.bn4_1 = nn.GroupNorm(8, nf * 8, affine=True) bn4_1 = nn.GroupNorm(8, nf * 8, affine=True)
final_nf = nf * 8 final_nf = nf * 8
# activation function # activation function
self.lrelu = nn.LeakyReLU(negative_slope=0.2, inplace=True) self.lrelu = nn.LeakyReLU(negative_slope=0.2, inplace=True)
self.body = nn.Sequential(self.conv0_0, self.lrelu, self.body = nn.Sequential(conv0_0, self.lrelu,
self.conv0_1, self.bn0_1, self.lrelu, conv0_1, bn0_1, self.lrelu,
self.conv1_0, self.bn1_0, self.lrelu, conv1_0, bn1_0, self.lrelu,
self.conv1_1, self.bn1_1, self.lrelu, conv1_1, bn1_1, self.lrelu,
self.conv2_0, self.bn2_0, self.lrelu, conv2_0, bn2_0, self.lrelu,
self.conv2_1, self.bn2_1, self.lrelu, conv2_1, bn2_1, self.lrelu,
self.conv3_0, self.bn3_0, self.lrelu, conv3_0, bn3_0, self.lrelu,
self.conv3_1, self.bn3_1, self.lrelu, conv3_1, bn3_1, self.lrelu,
self.conv4_0, self.bn4_0, self.lrelu, conv4_0, bn4_0, self.lrelu,
self.conv4_1, self.bn4_1, 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.linear1 = nn.Linear(int(final_nf * 4 * input_img_factor * 4 * input_img_factor), 100)
self.linear2 = nn.Linear(100, 1) self.linear2 = nn.Linear(100, 1)

View File

@ -67,10 +67,10 @@ class ProgressiveGeneratorInjector(Injector):
if not isinstance(inputs, list): if not isinstance(inputs, list):
inputs = [inputs] inputs = [inputs]
if not isinstance(self.output, list): 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 = {} # A list of outputs produced by feeding each progressive lq input into the generator.
results_hq = [] results_hq = []
for out_key in self.output: for out_key in output:
results[out_key] = [] results[out_key] = []
b, f, h, w = lq_inputs[:, 0].shape b, f, h, w = lq_inputs[:, 0].shape