diff --git a/pytorch_lightning/callbacks/model_checkpoint.py b/pytorch_lightning/callbacks/model_checkpoint.py index f0a8e159a2..80c4df8ae1 100644 --- a/pytorch_lightning/callbacks/model_checkpoint.py +++ b/pytorch_lightning/callbacks/model_checkpoint.py @@ -549,5 +549,5 @@ class ModelCheckpoint(Callback): best_k = {k: v.item() for k, v in self.best_k_models.items()} if filepath is None: filepath = os.path.join(self.dirpath, "best_k_models.yaml") - with open(filepath, "w") as fp: + with self._fs.open(filepath, "w") as fp: yaml.dump(best_k, fp)