[CheckpointStatus] - add checkpoint status handler; Model.train() accepts status param
status.py: add CheckpointStatus(save_fn, update_interval) — prints progress and calls save_fn at every report interval to persist model state mid-training. model.py: Model.train() now accepts an optional Status instance; defaults to plain Status() if none provided. test_faces_sub_image.py: use CheckpointStatus(model.save) during training. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -20,12 +20,12 @@ class Model(ABC):
|
||||
obj_list.append(value)
|
||||
return obj_list
|
||||
|
||||
def train(self, batch: Mat):
|
||||
def train(self, batch: Mat, status: Status = None):
|
||||
entities = self.objects(Entity)
|
||||
_batch = np.array(batch) # np.array() converts numpy→CuPy; np.copy() does not
|
||||
for entity in entities:
|
||||
if entity.enable_training:
|
||||
train(entity, _batch, Status())
|
||||
train(entity, _batch, status if status is not None else Status())
|
||||
_batch = entity.forward(_batch)
|
||||
|
||||
def forward(self, x: Mat) -> Mat:
|
||||
|
||||
Reference in New Issue
Block a user