@@ -428,25 +428,7 @@ def create_callbacks(cfg) -> list:
428428 callbacks .append (vis_callback )
429429
430430 # Model checkpoint callback
431- # Support both new unified config (training.checkpoint_*) and old separate config (checkpoint.*)
432- if hasattr (cfg , 'checkpoint' ) and cfg .checkpoint is not None :
433- # Old config style (backward compatibility)
434- monitor = getattr (cfg .checkpoint , 'monitor' , 'val/loss' )
435- default_filename = f'epoch={{epoch:03d}}-{ monitor } ={{{ monitor } :.4f}}'
436- filename = getattr (cfg .checkpoint , 'filename' , default_filename )
437-
438- checkpoint_callback = ModelCheckpoint (
439- monitor = monitor ,
440- mode = getattr (cfg .checkpoint , 'mode' , 'min' ),
441- save_top_k = getattr (cfg .checkpoint , 'save_top_k' , 3 ),
442- save_last = getattr (cfg .checkpoint , 'save_last' , True ),
443- dirpath = getattr (cfg .checkpoint , 'dirpath' , 'checkpoints' ),
444- filename = filename ,
445- verbose = True
446- )
447- callbacks .append (checkpoint_callback )
448- elif hasattr (cfg , 'monitor' ) and hasattr (cfg .monitor , 'checkpoint' ):
449- # New unified config style (monitor.checkpoint.*)
431+ if hasattr (cfg , 'monitor' ) and hasattr (cfg .monitor , 'checkpoint' ):
450432 monitor = getattr (cfg .monitor .checkpoint , 'monitor' , 'val/loss' )
451433 filename = getattr (cfg .monitor .checkpoint , 'filename' , None )
452434 if filename is None :
@@ -465,19 +447,7 @@ def create_callbacks(cfg) -> list:
465447 callbacks .append (checkpoint_callback )
466448
467449 # Early stopping callback
468- # Support both new unified config (training.early_stopping_*) and old separate config (early_stopping.*)
469- if hasattr (cfg , 'early_stopping' ) and cfg .early_stopping is not None and cfg .early_stopping .enabled :
470- # Old config style (backward compatibility)
471- early_stop_callback = EarlyStopping (
472- monitor = getattr (cfg .early_stopping , 'monitor' , 'val/loss' ),
473- patience = getattr (cfg .early_stopping , 'patience' , 10 ),
474- mode = getattr (cfg .early_stopping , 'mode' , 'min' ),
475- min_delta = getattr (cfg .early_stopping , 'min_delta' , 0.0 ),
476- verbose = True
477- )
478- callbacks .append (early_stop_callback )
479- elif hasattr (cfg , 'monitor' ) and hasattr (cfg .monitor , 'early_stopping' ) and getattr (cfg .monitor .early_stopping , 'enabled' , False ):
480- # New unified config style (monitor.early_stopping.*)
450+ if hasattr (cfg , 'monitor' ) and hasattr (cfg .monitor , 'early_stopping' ) and getattr (cfg .monitor .early_stopping , 'enabled' , False ):
481451 early_stop_callback = EarlyStopping (
482452 monitor = getattr (cfg .monitor .early_stopping , 'monitor' , 'val/loss' ),
483453 patience = getattr (cfg .monitor .early_stopping , 'patience' , 10 ),
0 commit comments