Skip to content

Commit f7aa0c5

Browse files
committed
Fix use path in fs.listdir in checkpoint (#15379)
1 parent 11196b1 commit f7aa0c5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/pytorch_lightning/trainer/connectors/checkpoint_connector.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import torch
2222
from torch import Tensor
2323
from torchmetrics import Metric
24+
from fsspec.core import uri_to_fs
2425

2526
import pytorch_lightning as pl
2627
from lightning_lite.plugins.environments.slurm import SLURMEnvironment
@@ -574,12 +575,12 @@ def __max_ckpt_version_in_folder(dir_path: _PATH, name_key: str = "ckpt_") -> Op
574575
"""
575576

576577
# check directory existence
577-
fs = get_filesystem(dir_path)
578+
fs, uri = uri_to_fs(dir_path)
578579
if not fs.exists(dir_path):
579580
return None
580581

581582
# check corresponding file existence
582-
files = [os.path.basename(f["name"]) for f in fs.listdir(dir_path)]
583+
files = [os.path.basename(f["name"]) for f in fs.listdir(uri)]
583584
files = [x for x in files if name_key in x]
584585
if len(files) == 0:
585586
return None

0 commit comments

Comments
 (0)