Skip to content

Commit

Permalink
fix: Blocks TrainingLog API adapt.
Browse files Browse the repository at this point in the history
- TrainingLog object in Blocks changed. Adapting it to the new form.

fix: default num_epoches
  • Loading branch information
hotloo committed Jul 22, 2016
1 parent 0614cc1 commit 5191e8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from argparse import ArgumentParser, Action
from collections import OrderedDict
import sys
from pandas import DataFrame

import numpy
import time
Expand Down Expand Up @@ -264,7 +265,7 @@ def setup_data(p, test_set=False):

# Only touch test data if requested
if test_set:
d.test = dataset_class("test")
d.test = dataset_class(["test"])
d.test_ind = numpy.arange(d.test.num_examples)

# Setup optional whitening, only used for Cifar-10
Expand Down Expand Up @@ -500,7 +501,7 @@ def train(cli_params):
main_loop.run()

# Get results
df = main_loop.log.to_dataframe()
df = DataFrame.from_dict(main_loop.log, orient='index')
col = 'valid_final_error_rate_clean'
logger.info('%s %g' % (col, df[col].iloc[-1]))

Expand Down
6 changes: 3 additions & 3 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def __init__(self, trigger_var, params, save_path, **kwargs):
self.params = params
self.to_save = {}
self.best_value = None
self.add_condition(['after_training'])
self.add_condition(['on_interrupt'])
self.add_condition(['after_training'], self.save)
self.add_condition(['on_interrupt'], self.save)

def save(self, which_callback, *args):
if self.var_name is None:
Expand Down Expand Up @@ -133,7 +133,7 @@ def __init__(self, dir, show=None, **kwargs):
self.show = show if show is not None else []

def do(self, which_callback, *args):
df = self.main_loop.log.to_dataframe()
df = DataFrame.from_dict(self.main_loop.log, orient='index')
df.to_hdf(os.path.join(self.dir, 'log'), 'log', mode='w',
complevel=5, complib='blosc')

Expand Down

0 comments on commit 5191e8e

Please sign in to comment.