Commit 63a72e48 authored by Guillaume HEUSCH's avatar Guillaume HEUSCH

[trainer] fixed the minimum amount of sampling, remove intermediate loss files

parent f287cf90
......@@ -132,7 +132,7 @@ class DRGANTrainer(object):
bob.io.base.create_directories_safe(log_dir)
# be sure to save samples at each epoch at least
if save_sample < len(dataloader):
if save_sample >= len(dataloader):
save_sample = len(dataloader) - 1
# labels for real/fake
......@@ -349,7 +349,14 @@ class DRGANTrainer(object):
f = bob.io.base.HDF5File(filename, 'w')
f.set('d_loss', discriminator_loss)
f.set('g_loss', generator_loss)
del f
# remove the previous one(s)
import glob, os
losses_files = glob.glob(logdir + '/losses_*')
for loss_file in losses_files:
if loss_file != filename:
os.remove(loss_file)
# save generated images at every epoch
# TODO: model moved to CPU and back and I don't really know why (expected CPU tensor error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment