@@ -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 ,
@@ -320,6 +322,8 @@ def __init__(
320322
321323 if global_step_transform is not None and not callable (global_step_transform ):
322324 raise TypeError (f"global_step_transform should be a function, got { type (global_step_transform )} instead." )
325+ if archived :
326+ warnings .warn ("Argument archived is deprecated and will be removed in 0.5.0" )
323327
324328 self .to_save = to_save
325329 self .filename_prefix = filename_prefix
@@ -878,6 +882,11 @@ class ModelCheckpoint(Checkpoint):
878882
879883 Behaviour of this class has been changed since v0.3.0.
880884
885+ Argument ``save_as_state_dict`` is deprecated and should not be used. It is considered as True.
886+
887+ Argument ``save_interval`` is deprecated and should not be used. Please, use events filtering instead, e.g.
888+ :attr:`~ignite.engine.events.Events.ITERATION_STARTED(every=1000)`
889+
881890 There is no more internal counter that has been used to indicate the number of save actions. User could
882891 see its value `step_number` in the filename, e.g. `{filename_prefix}_{name}_{step_number}.pt`. Actually,
883892 `step_number` is replaced by current engine's epoch if `score_function` is specified and current iteration
@@ -906,6 +915,7 @@ class ModelCheckpoint(Checkpoint):
906915 Input of the function is `(engine, event_name)`. Output of function should be an integer.
907916 Default is None, global_step based on attached engine. If provided, uses function output as global_step.
908917 To setup global step from another engine, please use :meth:`~ignite.handlers.global_step_from_engine`.
918+ archived: Deprecated argument as models saved by `torch.save` are already compressed.
909919 filename_pattern: If ``filename_pattern`` is provided, this pattern will be used to render
910920 checkpoint filenames. If the pattern is not defined, the default pattern would be used.
911921 See :class:`~ignite.handlers.checkpoint.Checkpoint` for details.
@@ -952,19 +962,38 @@ def __init__(
952962 self ,
953963 dirname : Union [str , Path ],
954964 filename_prefix : str = "" ,
965+ save_interval : Optional [Callable ] = None ,
955966 score_function : Optional [Callable ] = None ,
956967 score_name : Optional [str ] = None ,
957968 n_saved : Union [int , None ] = 1 ,
958969 atomic : bool = True ,
959970 require_empty : bool = True ,
960971 create_dir : bool = True ,
972+ save_as_state_dict : bool = True ,
961973 global_step_transform : Optional [Callable ] = None ,
974+ archived : bool = False ,
962975 filename_pattern : Optional [str ] = None ,
963976 include_self : bool = False ,
964977 greater_or_equal : bool = False ,
965978 save_on_rank : int = 0 ,
966979 ** kwargs : Any ,
967980 ):
981+ if not save_as_state_dict :
982+ raise ValueError (
983+ "Argument save_as_state_dict is deprecated and should be True."
984+ "This argument will be removed in 0.5.0."
985+ )
986+ if save_interval is not None :
987+ msg = (
988+ "Argument save_interval is deprecated and should be None. This argument will be removed in 0.5.0."
989+ "Please, use events filtering instead, e.g. Events.ITERATION_STARTED(every=1000)"
990+ )
991+ if save_interval == 1 :
992+ # Do not break for old version who used `save_interval=1`
993+ warnings .warn (msg )
994+ else :
995+ # No choice
996+ raise ValueError (msg )
968997
969998 disk_saver = DiskSaver (
970999 dirname ,
@@ -984,6 +1013,7 @@ def __init__(
9841013 n_saved = n_saved ,
9851014 global_step_transform = global_step_transform ,
9861015 filename_pattern = filename_pattern ,
1016+ archived = archived ,
9871017 include_self = include_self ,
9881018 greater_or_equal = greater_or_equal ,
9891019 save_on_rank = save_on_rank ,
0 commit comments