Skip to content

Commit d67e60f

Browse files
committed
fixed a bug in not saving the very last iteration
1 parent 0a98960 commit d67e60f

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

experiments/church_launcher.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ def options(self):
2020
name="church_default",
2121
patch_use_aggregation=False,
2222
),
23-
opt.specify(
24-
name="church_conservative",
25-
patch_use_aggregation=False,
26-
lambda_patch_R1=10.0,
27-
resume_iter="24950k",
28-
),
2923
]
3024

3125
def train_options(self):
@@ -45,7 +39,7 @@ def test_options(self):
4539
return [opt.tag("fig4").specify(
4640
num_gpus=1,
4741
batch_size=1,
48-
dataroot="~/datasets/testphotos/images_used_in_swapping_autoencoder_arxiv/church/fig4",
42+
dataroot="./testphotos/church/fig4",
4943
dataset_mode="imagefolder",
5044
preprocess="scale_shortside", # For testing, scale but don't crop
5145
evaluation_metrics="structure_style_grid_generation",

train.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,5 @@
5151

5252
iter_counter.record_one_iteration()
5353

54+
optimizer.save(iter_counter.steps_so_far)
5455
print('Training finished.')

util/iter_counter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def record_one_iteration(self):
5454
self.steps_so_far += self.batch_size
5555

5656
def needs_saving(self):
57-
return self.completed_training() or \
58-
(self.steps_so_far % self.opt.save_freq) < self.batch_size
57+
return (self.steps_so_far % self.opt.save_freq) < self.batch_size
5958

6059
def needs_evaluation(self):
6160
return (self.steps_so_far >= self.opt.evaluation_freq) and \

0 commit comments

Comments
 (0)