Commit 2fb8f750 authored by Yuxin Wu's avatar Yuxin Wu

disable callbacks.setter, make it a property

parent a26226f7
...@@ -124,7 +124,7 @@ def get_config(): ...@@ -124,7 +124,7 @@ def get_config():
dataflow=get_data(opt.data), dataflow=get_data(opt.data),
callbacks=[ModelSaver()], callbacks=[ModelSaver()],
steps_per_epoch=300, steps_per_epoch=300,
max_epoch=100, max_epoch=200,
) )
......
...@@ -94,8 +94,8 @@ class TrainConfig(object): ...@@ -94,8 +94,8 @@ class TrainConfig(object):
MovingAverageSummary(), MovingAverageSummary(),
ProgressBar(), ProgressBar(),
MergeAllSummaries()] MergeAllSummaries()]
self.callbacks = callbacks + extra_callbacks self._callbacks = callbacks + extra_callbacks
assert_type(self.callbacks, list) assert_type(self._callbacks, list)
if monitors is None: if monitors is None:
monitors = [TFSummaryWriter(), JSONWriter(), ScalarPrinter()] monitors = [TFSummaryWriter(), JSONWriter(), ScalarPrinter()]
...@@ -170,6 +170,10 @@ class TrainConfig(object): ...@@ -170,6 +170,10 @@ class TrainConfig(object):
def nr_tower(self, value): def nr_tower(self, value):
self.tower = list(range(value)) self.tower = list(range(value))
@property
def callbacks(self): # disable setter
return self._callbacks
@property @property
def optimizer(self): def optimizer(self):
""" for back-compatibilty only. will remove in the future""" """ for back-compatibilty only. will remove in the future"""
......
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