@@ -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
@@ -883,6 +887,11 @@ class ModelCheckpoint(Checkpoint):
883887
884888 Behaviour of this class has been changed since v0.3.0.
885889
890+ Argument ``save_as_state_dict`` is deprecated and should not be used. It is considered as True.
891+
892+ Argument ``save_interval`` is deprecated and should not be used. Please, use events filtering instead, e.g.
893+ :attr:`~ignite.engine.events.Events.ITERATION_STARTED(every=1000)`
894+
886895 There is no more internal counter that has been used to indicate the number of save actions. User could
887896 see its value `step_number` in the filename, e.g. `{filename_prefix}_{name}_{step_number}.pt`. Actually,
888897 `step_number` is replaced by current engine's epoch if `score_function` is specified and current iteration
@@ -911,6 +920,7 @@ class ModelCheckpoint(Checkpoint):
911920 Input of the function is `(engine, event_name)`. Output of function should be an integer.
912921 Default is None, global_step based on attached engine. If provided, uses function output as global_step.
913922 To setup global step from another engine, please use :meth:`~ignite.handlers.global_step_from_engine`.
923+ archived: Deprecated argument as models saved by `torch.save` are already compressed.
914924 filename_pattern: If ``filename_pattern`` is provided, this pattern will be used to render
915925 checkpoint filenames. If the pattern is not defined, the default pattern would be used.
916926 See :class:`~ignite.handlers.checkpoint.Checkpoint` for details.
@@ -957,19 +967,39 @@ def __init__(
957967 self ,
958968 dirname : Union [str , Path ],
959969 filename_prefix : str = "" ,
970+ save_interval : Optional [Callable ] = None ,
960971 score_function : Optional [Callable ] = None ,
961972 score_name : Optional [str ] = None ,
962973 n_saved : Union [int , None ] = 1 ,
963974 atomic : bool = True ,
964975 require_empty : bool = True ,
965976 create_dir : bool = True ,
977+ save_as_state_dict : bool = True ,
966978 global_step_transform : Optional [Callable ] = None ,
979+ archived : bool = False ,
967980 filename_pattern : Optional [str ] = None ,
968981 include_self : bool = False ,
969982 greater_or_equal : bool = False ,
970983 save_on_rank : int = 0 ,
971984 ** kwargs : Any ,
972985 ):
986+ if not save_as_state_dict :
987+ raise ValueError (
988+ "Argument save_as_state_dict is deprecated and should be True."
989+ "This argument will be removed in 0.5.0."
990+ )
991+ if save_interval is not None :
992+ msg = (
993+ "Argument save_interval is deprecated and should be None. This argument will be removed in 0.5.0."
994+ "Please, use events filtering instead, e.g. Events.ITERATION_STARTED(every=1000)"
995+ )
996+ if save_interval == 1 :
997+ # Do not break for old version who used `save_interval=1`
998+ warnings .warn (msg )
999+ else :
1000+ # No choice
1001+ raise ValueError (msg )
1002+
9731003 disk_saver = DiskSaver (
9741004 dirname ,
9751005 atomic = atomic ,
@@ -988,6 +1018,7 @@ def __init__(
9881018 n_saved = n_saved ,
9891019 global_step_transform = global_step_transform ,
9901020 filename_pattern = filename_pattern ,
1021+ archived = archived ,
9911022 include_self = include_self ,
9921023 greater_or_equal = greater_or_equal ,
9931024 save_on_rank = save_on_rank ,
0 commit comments