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:

Patch:
diff --git a/.travis.yml b/.travis.yml
index 96c42c0f..15c2b96c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -64,7 +64,7 @@ script:
   - python examples/mnist/mnist_with_tensorboard.py --epochs=1
   # 4) mnist_save_resume_engine.py
   - python examples/mnist/mnist_save_resume_engine.py --epochs=1 --crash_iteration 700
-  - python examples/mnist/mnist_save_resume_engine.py --epochs=1 --resume_from=/tmp/mnist_save_resume/checkpoint_550.pth
+  - python examples/mnist/mnist_save_resume_engine.py --epochs=1 --resume_from=/tmp/mnist_save_resume/checkpoint_550.pt
 
   # dcgan.py
   - python examples/gan/dcgan.py --dataset fake --dataroot /tmp/fakedata --output-dir /tmp/outputs-dcgan --batch-size 2 --epochs 2  --workers 0
diff --git a/docs/source/concepts.rst b/docs/source/concepts.rst
index 0ef4a53e..43fa1cf8 100644
--- a/docs/source/concepts.rst
+++ b/docs/source/concepts.rst
@@ -318,7 +318,7 @@ containing serialized trainer, model, optimizer, etc
 .. code-block:: bash
 
     ls /tmp/training
-    > "checkpoint_50000.pth"
+    > "checkpoint_50000.pt"
 
 We can then restore the training from the last checkpoint.
 
diff --git a/ignite/contrib/metrics/precision_recall_curve.py b/ignite/contrib/metrics/precision_recall_curve.py
index 397c5a4f..50a75317 100644
--- a/ignite/contrib/metrics/precision_recall_curve.py
+++ b/ignite/contrib/metrics/precision_recall_curve.py
@@ -37,5 +37,6 @@ class PrecisionRecallCurve(EpochMetric):
         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
index 436a151d..e9ee2167 100644
--- 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 @@ class Checkpoint:
             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 @@ class Checkpoint:
             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 @@ class Checkpoint:
         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 @@ class DiskSaver:
             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 @@ class ModelCheckpoint(Checkpoint):
                 "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 @@ class ModelCheckpoint(Checkpoint):
         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/.github/workflows/unittests.yml b/.github/workflows/unittests.yml
index d3bbf434..a43d5f08 100644
--- a/.github/workflows/unittests.yml
+++ b/.github/workflows/unittests.yml
@@ -73,7 +73,7 @@ jobs:
       run: |
         export PATH="$HOME/miniconda/bin:$PATH"
         source activate test-environment
-        python examples/mnist/mnist_save_resume_engine.py --epochs=1 --resume_from=/tmp/mnist_save_resume/checkpoint_550.pth
+        python examples/mnist/mnist_save_resume_engine.py --epochs=1 --resume_from=/tmp/mnist_save_resume/checkpoint_550.pt
 
     - name: Run GAN example
       run: |
diff --git a/tests/ignite/contrib/engines/test_common.py b/tests/ignite/contrib/engines/test_common.py
index f786ce19..ba76b1b3 100644
--- a/tests/ignite/contrib/engines/test_common.py
+++ b/tests/ignite/contrib/engines/test_common.py
@@ -167,7 +167,7 @@ def test_save_best_model_by_val_score(dirname, capsys):
     ]
     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
index 890bd339..845adcb2 100644
--- 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
index 1e3bb231..3109fc7e 100644
--- 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_checkpoint_default():
         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_checkpoint_with_global_step_transform():
         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_checkpoint_with_score_function():
         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_checkpoint_with_score_function():
 
         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_checkpoint_with_score_name_and_function():
         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_checkpoint_with_score_name_and_function():
 
         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_checkpoint_with_int_score():
         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_checkpoint_with_score_function_and_trainer_epoch():
         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_checkpoint_with_score_name_and_function_and_trainer_epoch():
         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_model_checkpoint_simple_recovery_from_existing_non_empty(dirname):
         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_model_checkpoint_simple_recovery_from_existing_non_empty(dirname):
         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 test_best_k(dirname):
     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 test_best_k_with_suffix(dirname):
         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 test_with_engine(dirname):
     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 test_save_model_optimizer_lr_scheduler_with_state_dict(dirname):
     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_disksaver_wrong_input(dirname):
         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")