Repository: pytorch/ignite

Issue:
Change Fileextension of checkpoints
## 🚀 Feature

Switch the default file extension for saving checkpoints to `.pt` instead of `.pth`.

We must ensure backward compatibility to also load `.pth` files, but raise a DeprecationWarning until 0.4.0

Reason: `.pth` is also used as an internal extension in python: https://docs.python.org/3.6/library/site.html


Discussion:

Resolving patch:
diff --git a/ignite/contrib/metrics/precision_recall_curve.py b/ignite/contrib/metrics/precision_recall_curve.py
--- a/ignite/contrib/metrics/precision_recall_curve.py
+++ b/ignite/contrib/metrics/precision_recall_curve.py
@@ -37,5 +37,6 @@ def activated_output_transform(output):
         roc_auc = PrecisionRecallCurve(activated_output_transform)
 
     """
+
     def __init__(self, output_transform=lambda x: x):
         super(PrecisionRecallCurve, self).__init__(precision_recall_curve_compute_fn, output_transform=output_transform)
diff --git a/ignite/handlers/checkpoint.py b/ignite/handlers/checkpoint.py
--- a/ignite/handlers/checkpoint.py
+++ b/ignite/handlers/checkpoint.py
@@ -38,7 +38,7 @@ class Checkpoint:
             Input of the function is `(engine, event_name)`. Output of function should be an integer.
             Default is None, global_step based on attached engine. If provided, uses function output as global_step.
             To setup global step from another engine, please use :meth:`~ignite.handlers.global_step_from_engine`.
-        archived (bool, optional): It True, saved checkpoint extension will be `.pth.tar`, Default value is False.
+        archived (bool, optional): Deprecated argument as models saved by `torch.save` are already compressed.
 
     Note:
         This class stores a single file as a dictionary of provided objects to save.
@@ -46,7 +46,6 @@ class Checkpoint:
 
         - `filename_prefix` is the argument passed to the constructor,
         - `name` is the key in `to_save` if a single object is to store, otherwise `name` is "checkpoint".
-        - `ext` is `.pth.tar` if `archived=True` otherwise `.pth`.
         - `suffix` is composed as following `{global_step}_{score_name}={score}`.
 
         Above `global_step` defined by the output of `global_step_transform` and `score` defined by the output
@@ -57,14 +56,14 @@ class Checkpoint:
         `{filename_prefix}_{name}_{engine.state.iteration}.{ext}`.
 
         If defined a `score_function`, but without `score_name`, then suffix is defined by provided score.
-        The filename will be `{filename_prefix}_{name}_{global_step}_{score}.pth`.
+        The filename will be `{filename_prefix}_{name}_{global_step}_{score}.pt`.
 
         If defined `score_function` and `score_name`, then the filename will
         be `{filename_prefix}_{name}_{score_name}={score}.{ext}`. If `global_step_transform` is provided, then
         the filename will be `{filename_prefix}_{name}_{global_step}_{score_name}={score}.{ext}`
 
         For example, `score_name="neg_val_loss"` and `score_function` that returns `-loss` (as objects with highest
-        scores will be retained), then saved filename will be `{filename_prefix}_{name}_neg_val_loss=-0.1234.pth`.
+        scores will be retained), then saved filename will be `{filename_prefix}_{name}_neg_val_loss=-0.1234.pt`.
 
         To get the last stored filename, handler exposes attribute `last_checkpoint`:
 
@@ -73,7 +72,7 @@ class Checkpoint:
             handler = Checkpoint(...)
             ...
             print(handler.last_checkpoint)
-            > checkpoint_12345.pth
+            > checkpoint_12345.pt
 
     Examples:
 
@@ -93,7 +92,7 @@ class Checkpoint:
             handler = Checkpoint(to_save, DiskSaver('/tmp/models', create_dir=True), n_saved=2)
             trainer.add_event_handler(Events.ITERATION_COMPLETED(every=1000), handler)
             trainer.run(data_loader, max_epochs=6)
-            > ["checkpoint_7000.pth", "checkpoint_8000.pth", ]
+            > ["checkpoint_7000.pt", "checkpoint_8000.pt", ]
 
         Attach the handler to an evaluator to save best model during the training
         according to computed validation metric:
@@ -120,7 +119,7 @@ def score_function(engine):
             evaluator.add_event_handler(Events.COMPLETED, handler)
 
             trainer.run(data_loader, max_epochs=10)
-            > ["best_model_9_val_acc=0.77.pth", "best_model_10_val_acc=0.78.pth", ]
+            > ["best_model_9_val_acc=0.77.pt", "best_model_10_val_acc=0.78.pt", ]
 
     """
 
@@ -154,6 +153,8 @@ def __init__(
             raise TypeError(
                 "global_step_transform should be a function, got {} instead.".format(type(global_step_transform))
             )
+        if archived:
+            warnings.warn("Argument archived is deprecated")
 
         self._check_objects(to_save, "state_dict")
         self._fname_prefix = filename_prefix + "_" if len(filename_prefix) > 0 else filename_prefix
@@ -163,7 +164,7 @@ def __init__(
         self._score_name = score_name
         self._n_saved = n_saved
         self._saved = []
-        self._ext = ".pth.tar" if archived else ".pth"
+        self._ext = ".pt"
         self.global_step_transform = global_step_transform
 
     @property
@@ -301,10 +302,10 @@ def __init__(self, dirname: str, atomic: bool = True, create_dir: bool = True, r
             raise ValueError("Directory path '{}' is not found".format(dirname))
 
         if require_empty:
-            matched = [fname for fname in os.listdir(dirname) if fname.endswith(".pth") or fname.endswith(".pth.tar")]
+            matched = [fname for fname in os.listdir(dirname) if fname.endswith(".pt")]
             if len(matched) > 0:
                 raise ValueError(
-                    "Files {} with extension '.pth' or '.pth.tar' are already present "
+                    "Files {} with extension '.pt' are already present "
                     "in the directory {}. If you want to use this "
                     "directory anyway, pass `require_empty=False`."
                     "".format(matched, dirname)
@@ -353,7 +354,7 @@ class ModelCheckpoint(Checkpoint):
         :attr:`~ignite.engine.Events.ITERATION_STARTED(every=1000)`
 
         There is no more internal counter that has been used to indicate the number of save actions. User could
-        see its value `step_number` in the filename, e.g. `{filename_prefix}_{name}_{step_number}.pth`. Actually,
+        see its value `step_number` in the filename, e.g. `{filename_prefix}_{name}_{step_number}.pt`. Actually,
         `step_number` is replaced by current engine's epoch if `score_function` is specified and current iteration
         otherwise.
 
@@ -380,7 +381,7 @@ class ModelCheckpoint(Checkpoint):
             Input of the function is `(engine, event_name)`. Output of function should be an integer.
             Default is None, global_step based on attached engine. If provided, uses function output as global_step.
             To setup global step from another engine, please use :meth:`~ignite.handlers.global_step_from_engine`.
-        archived (bool, optional): It True, saved checkpoint extension will be `.pth.tar`, Default value is False.
+        archived (bool, optional): Deprecated argument as models saved by `torch.save` are already compressed.
 
     Examples:
         >>> import os
@@ -393,9 +394,9 @@ class ModelCheckpoint(Checkpoint):
         >>> trainer.add_event_handler(Events.EPOCH_COMPLETED(every=2), handler, {'mymodel': model})
         >>> trainer.run([0], max_epochs=6)
         >>> os.listdir('/tmp/models')
-        ['myprefix_mymodel_4.pth', 'myprefix_mymodel_6.pth']
+        ['myprefix_mymodel_4.pt', 'myprefix_mymodel_6.pt']
         >>> handler.last_checkpoint
-        ['/tmp/models/myprefix_mymodel_6.pth']
+        ['/tmp/models/myprefix_mymodel_6.pt']
     """
 
     def __init__(
@@ -438,6 +439,9 @@ def __init__(
                 "global_step_transform should be a function, got {} instead.".format(type(global_step_transform))
             )
 
+        if archived:
+            warnings.warn("Argument archived is deprecated")
+
         self._fname_prefix = filename_prefix + "_" if len(filename_prefix) > 0 else filename_prefix
         self.save_handler = disk_saver
         self.to_save = None
@@ -445,7 +449,7 @@ def __init__(
         self._score_name = score_name
         self._n_saved = n_saved
         self._saved = []
-        self._ext = ".pth.tar" if archived else ".pth"
+        self._ext = ".pt"
         self.global_step_transform = global_step_transform
 
     @property


Test patch:
diff --git a/tests/ignite/contrib/engines/test_common.py b/tests/ignite/contrib/engines/test_common.py
--- a/tests/ignite/contrib/engines/test_common.py
+++ b/tests/ignite/contrib/engines/test_common.py
@@ -167,7 +167,7 @@ def set_eval_metric(engine):
     ]
     trainer.run(data, max_epochs=len(acc_scores))
 
-    assert set(os.listdir(dirname)) == set(["best_model_8_val_acc=0.6100.pth", "best_model_9_val_acc=0.7000.pth"])
+    assert set(os.listdir(dirname)) == set(["best_model_8_val_acc=0.6100.pt", "best_model_9_val_acc=0.7000.pt"])
 
 
 def test_add_early_stopping_by_val_score():
diff --git a/tests/ignite/contrib/handlers/test_neptune_logger.py b/tests/ignite/contrib/handlers/test_neptune_logger.py
--- a/tests/ignite/contrib/handlers/test_neptune_logger.py
+++ b/tests/ignite/contrib/handlers/test_neptune_logger.py
@@ -439,7 +439,7 @@ def test_neptune_saver_serializable(dummy_model_factory, dirname):
     to_save_serializable = {"model": model}
 
     saver = NeptuneSaver(mock_logger)
-    fname = "test.pth"
+    fname = "test.pt"
     saver(to_save_serializable, fname)
 
     assert mock_logger.experiment.log_artifact.call_count == 1
@@ -453,7 +453,7 @@ def test_neptune_saver_non_serializable(dirname):
     to_save_non_serializable = {"model": lambda x: x}
 
     saver = NeptuneSaver(mock_logger)
-    fname = "test.pth"
+    fname = "test.pt"
     try:
         with warnings.catch_warnings():
             # Ignore torch/serialization.py:292: UserWarning: Couldn't retrieve source code for container of type
diff --git a/tests/ignite/handlers/test_checkpoint.py b/tests/ignite/handlers/test_checkpoint.py
--- a/tests/ignite/handlers/test_checkpoint.py
+++ b/tests/ignite/handlers/test_checkpoint.py
@@ -59,6 +59,9 @@ def test_checkpoint_wrong_input():
     with pytest.raises(TypeError, match=r"global_step_transform should be a function."):
         Checkpoint(to_save, lambda x: x, score_function=lambda e: 123, score_name="acc", global_step_transform=123)
 
+    with pytest.warns(UserWarning, match=r"Argument archived is deprecated"):
+        Checkpoint(to_save, lambda x: x, score_function=lambda e: 123, score_name="acc", archived=True)
+
 
 def test_checkpoint_score_function_wrong_output():
     model = DummyModel()
@@ -85,16 +88,16 @@ def _test(to_save, obj, name):
         checkpointer(trainer)
         assert save_handler.call_count == 1
 
-        save_handler.assert_called_with(obj, "{}_0.pth".format(name))
+        save_handler.assert_called_with(obj, "{}_0.pt".format(name))
 
         trainer.state.epoch = 12
         trainer.state.iteration = 1234
         checkpointer(trainer)
         assert save_handler.call_count == 2
-        save_handler.assert_called_with(obj, "{}_1234.pth".format(name))
+        save_handler.assert_called_with(obj, "{}_1234.pt".format(name))
         assert save_handler.remove.call_count == 1
-        save_handler.remove.assert_called_with("{}_0.pth".format(name))
-        assert checkpointer.last_checkpoint == "{}_1234.pth".format(name)
+        save_handler.remove.assert_called_with("{}_0.pt".format(name))
+        assert checkpointer.last_checkpoint == "{}_1234.pt".format(name)
 
     model = DummyModel()
     to_save = {"model": model}
@@ -127,16 +130,16 @@ def _test(filename_prefix, to_save, obj, name):
         if len(filename_prefix) > 0:
             filename_prefix += "_"
 
-        save_handler.assert_called_with(obj, "{}{}_1.pth".format(filename_prefix, name))
+        save_handler.assert_called_with(obj, "{}{}_1.pt".format(filename_prefix, name))
 
         trainer.state.epoch = 12
         trainer.state.iteration = 1234
         checkpointer(trainer)
         assert save_handler.call_count == 2
-        save_handler.assert_called_with(obj, "{}{}_12.pth".format(filename_prefix, name))
+        save_handler.assert_called_with(obj, "{}{}_12.pt".format(filename_prefix, name))
         assert save_handler.remove.call_count == 1
-        save_handler.remove.assert_called_with("{}{}_1.pth".format(filename_prefix, name))
-        assert checkpointer.last_checkpoint == "{}{}_12.pth".format(filename_prefix, name)
+        save_handler.remove.assert_called_with("{}{}_1.pt".format(filename_prefix, name))
+        assert checkpointer.last_checkpoint == "{}{}_12.pt".format(filename_prefix, name)
 
     for prefix in ["", "dummytask"]:
         model = DummyModel()
@@ -162,7 +165,7 @@ def _test(to_save, obj, name):
         checkpointer(trainer)
         assert save_handler.call_count == 1
 
-        save_handler.assert_called_with(obj, "{}_0.7700.pth".format(name))
+        save_handler.assert_called_with(obj, "{}_0.7700.pt".format(name))
 
         trainer.state.epoch = 12
         trainer.state.iteration = 1234
@@ -170,10 +173,10 @@ def _test(to_save, obj, name):
 
         checkpointer(trainer)
         assert save_handler.call_count == 2
-        save_handler.assert_called_with(obj, "{}_0.7800.pth".format(name))
+        save_handler.assert_called_with(obj, "{}_0.7800.pt".format(name))
         assert save_handler.remove.call_count == 1
-        save_handler.remove.assert_called_with("{}_0.7700.pth".format(name))
-        assert checkpointer.last_checkpoint == "{}_0.7800.pth".format(name)
+        save_handler.remove.assert_called_with("{}_0.7700.pt".format(name))
+        assert checkpointer.last_checkpoint == "{}_0.7800.pt".format(name)
 
     model = DummyModel()
     to_save = {"model": model}
@@ -200,7 +203,7 @@ def _test(to_save, obj, name):
         checkpointer(trainer)
         assert save_handler.call_count == 1
 
-        save_handler.assert_called_with(obj, "{}_loss=-0.7700.pth".format(name))
+        save_handler.assert_called_with(obj, "{}_loss=-0.7700.pt".format(name))
 
         trainer.state.epoch = 12
         trainer.state.iteration = 1234
@@ -208,10 +211,10 @@ def _test(to_save, obj, name):
 
         checkpointer(trainer)
         assert save_handler.call_count == 2
-        save_handler.assert_called_with(obj, "{}_loss=-0.7600.pth".format(name))
+        save_handler.assert_called_with(obj, "{}_loss=-0.7600.pt".format(name))
         assert save_handler.remove.call_count == 1
-        save_handler.remove.assert_called_with("{}_loss=-0.7700.pth".format(name))
-        assert checkpointer.last_checkpoint == "{}_loss=-0.7600.pth".format(name)
+        save_handler.remove.assert_called_with("{}_loss=-0.7700.pt".format(name))
+        assert checkpointer.last_checkpoint == "{}_loss=-0.7600.pt".format(name)
 
     model = DummyModel()
     to_save = {"model": model}
@@ -243,17 +246,17 @@ def _test(to_save, obj, name, score_name=None):
         checkpointer(trainer)
         assert save_handler.call_count == 1
 
-        save_handler.assert_called_with(obj, "{}_{}1.pth".format(name, score_name))
+        save_handler.assert_called_with(obj, "{}_{}1.pt".format(name, score_name))
 
         trainer.state.epoch = 12
         trainer.state.iteration = 1234
 
         checkpointer(trainer)
         assert save_handler.call_count == 2
-        save_handler.assert_called_with(obj, "{}_{}12.pth".format(name, score_name))
+        save_handler.assert_called_with(obj, "{}_{}12.pt".format(name, score_name))
         assert save_handler.remove.call_count == 1
-        save_handler.remove.assert_called_with("{}_{}1.pth".format(name, score_name))
-        assert checkpointer.last_checkpoint == "{}_{}12.pth".format(name, score_name)
+        save_handler.remove.assert_called_with("{}_{}1.pt".format(name, score_name))
+        assert checkpointer.last_checkpoint == "{}_{}12.pt".format(name, score_name)
 
     model = DummyModel()
     to_save = {"model": model}
@@ -287,17 +290,17 @@ def _test(to_save, obj, name):
         checkpointer(evaluator)
         assert save_handler.call_count == 1
 
-        save_handler.assert_called_with(obj, "{}_11_0.7700.pth".format(name))
+        save_handler.assert_called_with(obj, "{}_11_0.7700.pt".format(name))
 
         trainer.state.epoch = 12
         evaluator.state.metrics["val_acc"] = 0.78
 
         checkpointer(evaluator)
         assert save_handler.call_count == 2
-        save_handler.assert_called_with(obj, "{}_12_0.7800.pth".format(name))
+        save_handler.assert_called_with(obj, "{}_12_0.7800.pt".format(name))
         assert save_handler.remove.call_count == 1
-        save_handler.remove.assert_called_with("{}_11_0.7700.pth".format(name))
-        assert checkpointer.last_checkpoint == "{}_12_0.7800.pth".format(name)
+        save_handler.remove.assert_called_with("{}_11_0.7700.pt".format(name))
+        assert checkpointer.last_checkpoint == "{}_12_0.7800.pt".format(name)
 
     model = DummyModel()
     to_save = {"model": model}
@@ -326,17 +329,17 @@ def _test(to_save, obj, name):
         checkpointer(evaluator)
         assert save_handler.call_count == 1
 
-        save_handler.assert_called_with(obj, "{}_11_val_acc=0.7700.pth".format(name))
+        save_handler.assert_called_with(obj, "{}_11_val_acc=0.7700.pt".format(name))
 
         trainer.state.epoch = 12
         evaluator.state.metrics["val_acc"] = 0.78
 
         checkpointer(evaluator)
         assert save_handler.call_count == 2
-        save_handler.assert_called_with(obj, "{}_12_val_acc=0.7800.pth".format(name))
+        save_handler.assert_called_with(obj, "{}_12_val_acc=0.7800.pt".format(name))
         assert save_handler.remove.call_count == 1
-        save_handler.remove.assert_called_with("{}_11_val_acc=0.7700.pth".format(name))
-        assert checkpointer.last_checkpoint == "{}_12_val_acc=0.7800.pth".format(name)
+        save_handler.remove.assert_called_with("{}_11_val_acc=0.7700.pt".format(name))
+        assert checkpointer.last_checkpoint == "{}_12_val_acc=0.7800.pt".format(name)
 
     model = DummyModel()
     to_save = {"model": model}
@@ -357,7 +360,7 @@ def test_checkpoint_last_checkpoint():
         checkpointer(trainer)
 
     assert save_handler.call_count == 10
-    assert checkpointer.last_checkpoint == "{}_9.pth".format("model")
+    assert checkpointer.last_checkpoint == "{}_9.pt".format("model")
 
 
 def test_checkpoint_last_checkpoint_on_score():
@@ -382,7 +385,7 @@ def test_checkpoint_last_checkpoint_on_score():
         checkpointer(trainer)
 
     assert save_handler.call_count == 10
-    assert checkpointer.last_checkpoint == "{}_val_acc=0.9000.pth".format("model")
+    assert checkpointer.last_checkpoint == "{}_val_acc=0.9000.pt".format("model")
 
 
 def test_model_checkpoint_args_validation(dirname):
@@ -392,10 +395,10 @@ def test_model_checkpoint_args_validation(dirname):
     os.makedirs(existing)
     os.makedirs(nonempty)
 
-    with open(os.path.join(nonempty, "{}_name_0.pth".format(_PREFIX)), "w"):
+    with open(os.path.join(nonempty, "{}_name_0.pt".format(_PREFIX)), "w"):
         pass
 
-    with pytest.raises(ValueError, match=r"with extension '.pth' or '.pth.tar' are already present "):
+    with pytest.raises(ValueError, match=r"with extension '.pt' are already present "):
         ModelCheckpoint(nonempty, _PREFIX)
 
     with pytest.raises(ValueError, match=r"Argument save_interval is deprecated and should be None"):
@@ -413,6 +416,9 @@ def test_model_checkpoint_args_validation(dirname):
     with pytest.raises(TypeError, match=r"global_step_transform should be a function"):
         ModelCheckpoint(existing, _PREFIX, create_dir=False, global_step_transform=1234)
 
+    with pytest.warns(UserWarning, match=r"Argument archived is deprecated"):
+        ModelCheckpoint(existing, _PREFIX, create_dir=False, archived=True)
+
     h = ModelCheckpoint(dirname, _PREFIX, create_dir=False)
     assert h.last_checkpoint is None
     with pytest.raises(RuntimeError, match=r"No objects to checkpoint found."):
@@ -437,12 +443,12 @@ def test_model_checkpoint_simple_recovery(dirname):
 
 
 def test_model_checkpoint_simple_recovery_from_existing_non_empty(dirname):
-    def _test(ext, require_empty, archived):
+    def _test(ext, require_empty):
         previous_fname = os.path.join(dirname, "{}_{}_{}{}".format(_PREFIX, "obj", 1, ext))
         with open(previous_fname, "w") as f:
             f.write("test")
 
-        h = ModelCheckpoint(dirname, _PREFIX, create_dir=True, require_empty=require_empty, archived=archived)
+        h = ModelCheckpoint(dirname, _PREFIX, create_dir=True, require_empty=require_empty)
         engine = Engine(lambda e, b: None)
         engine.state = State(epoch=0, iteration=1)
 
@@ -451,7 +457,7 @@ def _test(ext, require_empty, archived):
         h(engine, to_save)
 
         fname = h.last_checkpoint
-        ext = ".pth.tar" if archived else ".pth"
+        ext = ".pt"
         assert isinstance(fname, str)
         assert os.path.join(dirname, "{}_{}_{}{}".format(_PREFIX, "model", 1, ext)) == fname
         assert os.path.exists(fname)
@@ -460,9 +466,8 @@ def _test(ext, require_empty, archived):
         assert loaded_objects == model.state_dict()
         os.remove(fname)
 
-    _test(".txt", require_empty=True, archived=False)
-    _test(".txt", require_empty=True, archived=True)
-    _test(".pth", require_empty=False, archived=False)
+    _test(".txt", require_empty=True)
+    _test(".pt", require_empty=False)
 
 
 def test_disk_saver_atomic(dirname):
@@ -474,7 +479,7 @@ def test_disk_saver_atomic(dirname):
     def _test_existance(atomic, _to_save, expected):
 
         saver = DiskSaver(dirname, atomic=atomic, create_dir=False, require_empty=False)
-        fname = "test.pth"
+        fname = "test.pt"
         try:
             with warnings.catch_warnings():
                 # Ignore torch/serialization.py:292: UserWarning: Couldn't retrieve source code for container of type
@@ -509,7 +514,7 @@ def test_last_k(dirname):
         engine.state.iteration = i
         h(engine, to_save)
 
-    expected = ["{}_{}_{}.pth".format(_PREFIX, "model", i) for i in [7, 8]]
+    expected = ["{}_{}_{}.pt".format(_PREFIX, "model", i) for i in [7, 8]]
 
     assert sorted(os.listdir(dirname)) == expected, "{} vs {}".format(sorted(os.listdir(dirname)), expected)
 
@@ -531,7 +536,7 @@ def test_disabled_n_saved(dirname):
     saved_files = sorted(os.listdir(dirname))
     assert len(saved_files) == num_iters, "{}".format(saved_files)
 
-    expected = sorted(["{}_{}_{}.pth".format(_PREFIX, "model", i) for i in range(num_iters)])
+    expected = sorted(["{}_{}_{}.pt".format(_PREFIX, "model", i) for i in range(num_iters)])
     assert saved_files == expected, "{} vs {}".format(saved_files, expected)
 
 
@@ -551,7 +556,7 @@ def score_function(_):
     for _ in range(4):
         h(engine, to_save)
 
-    expected = ["{}_{}_{:.4f}.pth".format(_PREFIX, "model", i) for i in [1.2, 3.1]]
+    expected = ["{}_{}_{:.4f}.pt".format(_PREFIX, "model", i) for i in [1.2, 3.1]]
 
     assert sorted(os.listdir(dirname)) == expected
 
@@ -576,7 +581,7 @@ def score_function(engine):
         engine.state.epoch += 1
         h(engine, to_save)
 
-    expected = ["{}_{}_val_loss={:.4}.pth".format(_PREFIX, "model", scores[e - 1]) for e in [1, 3]]
+    expected = ["{}_{}_val_loss={:.4}.pt".format(_PREFIX, "model", scores[e - 1]) for e in [1, 3]]
 
     assert sorted(os.listdir(dirname)) == expected
 
@@ -616,7 +621,7 @@ def update_fn(_1, _2):
     engine.add_event_handler(Events.EPOCH_COMPLETED, handler, to_save)
     engine.run([0], max_epochs=4)
 
-    expected = ["{}_{}_{}.pth".format(_PREFIX, name, i) for i in [3, 4]]
+    expected = ["{}_{}_{}.pt".format(_PREFIX, name, i) for i in [3, 4]]
 
     assert sorted(os.listdir(dirname)) == expected
 
@@ -690,7 +695,7 @@ def update_fn(engine, batch):
     engine.run([0], max_epochs=4)
 
     saved_objects = sorted(os.listdir(dirname))
-    # saved object is ['PREFIX_checkpoint_4.pth', ]
+    # saved object is ['PREFIX_checkpoint_4.pt', ]
     saved_checkpoint = os.path.join(dirname, saved_objects[0])
 
     loaded_obj = torch.load(saved_checkpoint)
@@ -839,8 +844,7 @@ def _test(ext):
         with open(previous_fname, "w") as f:
             f.write("test")
 
-        with pytest.raises(ValueError, match=r"with extension '.pth' or '.pth.tar' are already present"):
+        with pytest.raises(ValueError, match=r"with extension '.pt' are already present"):
             DiskSaver(dirname, require_empty=True)
 
-    _test(".pth")
-    _test(".pth.tar")
+    _test(".pt")