@@ -94,6 +94,7 @@ class Checkpoint(Serializable):
9494 Input of the function is ``(engine, event_name)``. Output of function should be an integer.
9595 Default is None, global_step based on attached engine. If provided, uses function output as global_step.
9696 To setup global step from another engine, please use :meth:`~ignite.handlers.global_step_from_engine`.
97+ archived: Deprecated argument as models saved by ``torch.save`` are already compressed.
9798 filename_pattern: If ``filename_pattern`` is provided, this pattern will be used to render
9899 checkpoint filenames. If the pattern is not defined, the default pattern would be used. See Note for
99100 details.
@@ -277,6 +278,7 @@ def __init__(
277278 score_name : Optional [str ] = None ,
278279 n_saved : Union [int , None ] = 1 ,
279280 global_step_transform : Optional [Callable ] = None ,
281+ archived : bool = False ,
280282 filename_pattern : Optional [str ] = None ,
281283 include_self : bool = False ,
282284 greater_or_equal : bool = False ,
@@ -308,6 +310,8 @@ def __init__(
308310
309311 if global_step_transform is not None and not callable (global_step_transform ):
310312 raise TypeError (f"global_step_transform should be a function, got { type (global_step_transform )} instead." )
313+ if archived :
314+ warnings .warn ("Argument archived is deprecated and will be removed in 0.5.0" )
311315
312316 self .to_save = to_save
313317 self .filename_prefix = filename_prefix
@@ -864,6 +868,11 @@ class ModelCheckpoint(Checkpoint):
864868
865869 Behaviour of this class has been changed since v0.3.0.
866870
871+ Argument ``save_as_state_dict`` is deprecated and should not be used. It is considered as True.
872+
873+ Argument ``save_interval`` is deprecated and should not be used. Please, use events filtering instead, e.g.
874+ :attr:`~ignite.engine.events.Events.ITERATION_STARTED(every=1000)`
875+
867876 There is no more internal counter that has been used to indicate the number of save actions. User could
868877 see its value `step_number` in the filename, e.g. `{filename_prefix}_{name}_{step_number}.pt`. Actually,
869878 `step_number` is replaced by current engine's epoch if `score_function` is specified and current iteration
@@ -892,6 +901,7 @@ class ModelCheckpoint(Checkpoint):
892901 Input of the function is `(engine, event_name)`. Output of function should be an integer.
893902 Default is None, global_step based on attached engine. If provided, uses function output as global_step.
894903 To setup global step from another engine, please use :meth:`~ignite.handlers.global_step_from_engine`.
904+ archived: Deprecated argument as models saved by `torch.save` are already compressed.
895905 filename_pattern: If ``filename_pattern`` is provided, this pattern will be used to render
896906 checkpoint filenames. If the pattern is not defined, the default pattern would be used.
897907 See :class:`~ignite.handlers.checkpoint.Checkpoint` for details.
@@ -930,19 +940,39 @@ def __init__(
930940 self ,
931941 dirname : Union [str , Path ],
932942 filename_prefix : str = "" ,
943+ save_interval : Optional [Callable ] = None ,
933944 score_function : Optional [Callable ] = None ,
934945 score_name : Optional [str ] = None ,
935946 n_saved : Union [int , None ] = 1 ,
936947 atomic : bool = True ,
937948 require_empty : bool = True ,
938949 create_dir : bool = True ,
950+ save_as_state_dict : bool = True ,
939951 global_step_transform : Optional [Callable ] = None ,
952+ archived : bool = False ,
940953 filename_pattern : Optional [str ] = None ,
941954 include_self : bool = False ,
942955 greater_or_equal : bool = False ,
943956 ** kwargs : Any ,
944957 ):
945958
959+ if not save_as_state_dict :
960+ raise ValueError (
961+ "Argument save_as_state_dict is deprecated and should be True."
962+ "This argument will be removed in 0.5.0."
963+ )
964+ if save_interval is not None :
965+ msg = (
966+ "Argument save_interval is deprecated and should be None. This argument will be removed in 0.5.0."
967+ "Please, use events filtering instead, e.g. Events.ITERATION_STARTED(every=1000)"
968+ )
969+ if save_interval == 1 :
970+ # Do not break for old version who used `save_interval=1`
971+ warnings .warn (msg )
972+ else :
973+ # No choice
974+ raise ValueError (msg )
975+
946976 disk_saver = DiskSaver (dirname , atomic = atomic , create_dir = create_dir , require_empty = require_empty , ** kwargs )
947977
948978 super (ModelCheckpoint , self ).__init__ (
@@ -954,6 +984,7 @@ def __init__(
954984 n_saved = n_saved ,
955985 global_step_transform = global_step_transform ,
956986 filename_pattern = filename_pattern ,
987+ archived = archived ,
957988 include_self = include_self ,
958989 greater_or_equal = greater_or_equal ,
959990 )
0 commit comments