@@ -102,6 +102,7 @@ class Checkpoint(Serializable):
102102 Input of the function is ``(engine, event_name)``. Output of function should be an integer.
103103 Default is None, global_step based on attached engine. If provided, uses function output as global_step.
104104 To setup global step from another engine, please use :meth:`~ignite.handlers.global_step_from_engine`.
105+ archived: Deprecated argument as models saved by ``torch.save`` are already compressed.
105106 filename_pattern: If ``filename_pattern`` is provided, this pattern will be used to render
106107 checkpoint filenames. If the pattern is not defined, the default pattern would be used. See Note for
107108 details.
@@ -288,6 +289,7 @@ def __init__(
288289 score_name : Optional [str ] = None ,
289290 n_saved : Union [int , None ] = 1 ,
290291 global_step_transform : Optional [Callable ] = None ,
292+ archived : bool = False ,
291293 filename_pattern : Optional [str ] = None ,
292294 include_self : bool = False ,
293295 greater_or_equal : bool = False ,
@@ -319,6 +321,8 @@ def __init__(
319321
320322 if global_step_transform is not None and not callable (global_step_transform ):
321323 raise TypeError (f"global_step_transform should be a function, got { type (global_step_transform )} instead." )
324+ if archived :
325+ warnings .warn ("Argument archived is deprecated and will be removed in 0.5.0" )
322326
323327 self .to_save = to_save
324328 self .filename_prefix = filename_prefix
@@ -880,6 +884,11 @@ class ModelCheckpoint(Checkpoint):
880884
881885 Behaviour of this class has been changed since v0.3.0.
882886
887+ Argument ``save_as_state_dict`` is deprecated and should not be used. It is considered as True.
888+
889+ Argument ``save_interval`` is deprecated and should not be used. Please, use events filtering instead, e.g.
890+ :attr:`~ignite.engine.events.Events.ITERATION_STARTED(every=1000)`
891+
883892 There is no more internal counter that has been used to indicate the number of save actions. User could
884893 see its value `step_number` in the filename, e.g. `{filename_prefix}_{name}_{step_number}.pt`. Actually,
885894 `step_number` is replaced by current engine's epoch if `score_function` is specified and current iteration
@@ -908,6 +917,7 @@ class ModelCheckpoint(Checkpoint):
908917 Input of the function is `(engine, event_name)`. Output of function should be an integer.
909918 Default is None, global_step based on attached engine. If provided, uses function output as global_step.
910919 To setup global step from another engine, please use :meth:`~ignite.handlers.global_step_from_engine`.
920+ archived: Deprecated argument as models saved by `torch.save` are already compressed.
911921 filename_pattern: If ``filename_pattern`` is provided, this pattern will be used to render
912922 checkpoint filenames. If the pattern is not defined, the default pattern would be used.
913923 See :class:`~ignite.handlers.checkpoint.Checkpoint` for details.
@@ -954,19 +964,39 @@ def __init__(
954964 self ,
955965 dirname : Union [str , Path ],
956966 filename_prefix : str = "" ,
967+ save_interval : Optional [Callable ] = None ,
957968 score_function : Optional [Callable ] = None ,
958969 score_name : Optional [str ] = None ,
959970 n_saved : Union [int , None ] = 1 ,
960971 atomic : bool = True ,
961972 require_empty : bool = True ,
962973 create_dir : bool = True ,
974+ save_as_state_dict : bool = True ,
963975 global_step_transform : Optional [Callable ] = None ,
976+ archived : bool = False ,
964977 filename_pattern : Optional [str ] = None ,
965978 include_self : bool = False ,
966979 greater_or_equal : bool = False ,
967980 save_on_rank : int = 0 ,
968981 ** kwargs : Any ,
969982 ):
983+ if not save_as_state_dict :
984+ raise ValueError (
985+ "Argument save_as_state_dict is deprecated and should be True."
986+ "This argument will be removed in 0.5.0."
987+ )
988+ if save_interval is not None :
989+ msg = (
990+ "Argument save_interval is deprecated and should be None. This argument will be removed in 0.5.0."
991+ "Please, use events filtering instead, e.g. Events.ITERATION_STARTED(every=1000)"
992+ )
993+ if save_interval == 1 :
994+ # Do not break for old version who used `save_interval=1`
995+ warnings .warn (msg )
996+ else :
997+ # No choice
998+ raise ValueError (msg )
999+
9701000 disk_saver = DiskSaver (
9711001 dirname ,
9721002 atomic = atomic ,
@@ -985,6 +1015,7 @@ def __init__(
9851015 n_saved = n_saved ,
9861016 global_step_transform = global_step_transform ,
9871017 filename_pattern = filename_pattern ,
1018+ archived = archived ,
9881019 include_self = include_self ,
9891020 greater_or_equal = greater_or_equal ,
9901021 save_on_rank = save_on_rank ,
0 commit comments