@@ -93,6 +93,7 @@ class Checkpoint(Serializable):
9393 Input of the function is ``(engine, event_name)``. Output of function should be an integer.
9494 Default is None, global_step based on attached engine. If provided, uses function output as global_step.
9595 To setup global step from another engine, please use :meth:`~ignite.handlers.global_step_from_engine`.
96+ archived: Deprecated argument as models saved by ``torch.save`` are already compressed.
9697 filename_pattern: If ``filename_pattern`` is provided, this pattern will be used to render
9798 checkpoint filenames. If the pattern is not defined, the default pattern would be used. See Note for
9899 details.
@@ -276,6 +277,7 @@ def __init__(
276277 score_name : Optional [str ] = None ,
277278 n_saved : Optional [int ] = 1 ,
278279 global_step_transform : Optional [Callable ] = None ,
280+ archived : bool = False ,
279281 filename_pattern : Optional [str ] = None ,
280282 include_self : bool = False ,
281283 greater_or_equal : bool = False ,
@@ -300,6 +302,8 @@ def __init__(
300302
301303 if global_step_transform is not None and not callable (global_step_transform ):
302304 raise TypeError (f"global_step_transform should be a function, got { type (global_step_transform )} instead." )
305+ if archived :
306+ warnings .warn ("Argument archived is deprecated and will be removed in 0.5.0" )
303307
304308 self .to_save = to_save
305309 self .filename_prefix = filename_prefix
@@ -755,6 +759,11 @@ class ModelCheckpoint(Checkpoint):
755759
756760 Behaviour of this class has been changed since v0.3.0.
757761
762+ Argument ``save_as_state_dict`` is deprecated and should not be used. It is considered as True.
763+
764+ Argument ``save_interval`` is deprecated and should not be used. Please, use events filtering instead, e.g.
765+ :attr:`~ignite.engine.events.Events.ITERATION_STARTED(every=1000)`
766+
758767 There is no more internal counter that has been used to indicate the number of save actions. User could
759768 see its value `step_number` in the filename, e.g. `{filename_prefix}_{name}_{step_number}.pt`. Actually,
760769 `step_number` is replaced by current engine's epoch if `score_function` is specified and current iteration
@@ -785,6 +794,7 @@ class ModelCheckpoint(Checkpoint):
785794 To setup global step from another engine, please use :meth:`~ignite.handlers.global_step_from_engine`.
786795 include_self: Whether to include the `state_dict` of this object in the checkpoint. If `True`, then
787796 there must not be another object in ``to_save`` with key ``checkpointer``.
797+ archived: Deprecated argument as models saved by `torch.save` are already compressed.
788798 kwargs: Accepted keyword arguments for `torch.save` or `xm.save` in `DiskSaver`.
789799
790800 .. versionchanged:: 0.4.2
@@ -812,17 +822,37 @@ def __init__(
812822 self ,
813823 dirname : str ,
814824 filename_prefix : str ,
825+ save_interval : Optional [Callable ] = None ,
815826 score_function : Optional [Callable ] = None ,
816827 score_name : Optional [str ] = None ,
817828 n_saved : Union [int , None ] = 1 ,
818829 atomic : bool = True ,
819830 require_empty : bool = True ,
820831 create_dir : bool = True ,
832+ save_as_state_dict : bool = True ,
821833 global_step_transform : Optional [Callable ] = None ,
834+ archived : bool = False ,
822835 include_self : bool = False ,
823836 ** kwargs : Any ,
824837 ):
825838
839+ if not save_as_state_dict :
840+ raise ValueError (
841+ "Argument save_as_state_dict is deprecated and should be True."
842+ "This argument will be removed in 0.5.0."
843+ )
844+ if save_interval is not None :
845+ msg = (
846+ "Argument save_interval is deprecated and should be None. This argument will be removed in 0.5.0."
847+ "Please, use events filtering instead, e.g. Events.ITERATION_STARTED(every=1000)"
848+ )
849+ if save_interval == 1 :
850+ # Do not break for old version who used `save_interval=1`
851+ warnings .warn (msg )
852+ else :
853+ # No choice
854+ raise ValueError (msg )
855+
826856 disk_saver = DiskSaver (dirname , atomic = atomic , create_dir = create_dir , require_empty = require_empty , ** kwargs )
827857
828858 super (ModelCheckpoint , self ).__init__ (
@@ -833,6 +863,7 @@ def __init__(
833863 score_name = score_name ,
834864 n_saved = n_saved ,
835865 global_step_transform = global_step_transform ,
866+ archived = archived ,
836867 include_self = include_self ,
837868 )
838869
0 commit comments