Skip to content

Commit b14c4d4

Browse files
authored
handle fsspec inconsistency in PyArrowHDFS (#3805)
1 parent 74484ed commit b14c4d4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pytorch_lightning/loggers/tensorboard.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ def _get_next_version(self):
232232
return 0
233233

234234
existing_versions = []
235-
for d in self._fs.ls(root_dir):
235+
for listing in self._fs.listdir(root_dir):
236+
d = listing["name"]
236237
bn = os.path.basename(d)
237238
if self._fs.isdir(d) and bn.startswith("version_"):
238239
dir_ver = bn.split("_")[1].replace('/', '')

pytorch_lightning/trainer/connectors/checkpoint_connector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def restore_hpc_weights_if_needed(self, model: LightningModule):
194194
folderpath = str(self.trainer.weights_save_path)
195195
fs = get_filesystem(folderpath)
196196
if fs.exists(folderpath):
197-
files = [os.path.basename(f) for f in fs.ls(folderpath)]
197+
files = [os.path.basename(f['name']) for f in fs.listdir(folderpath)]
198198
hpc_weight_paths = [x for x in files if 'hpc_ckpt' in x]
199199

200200
# if hpc weights exist restore model
@@ -333,7 +333,7 @@ def hpc_load(self, folderpath, on_gpu):
333333

334334
def max_ckpt_in_folder(self, path, name_key='ckpt_'):
335335
fs = get_filesystem(path)
336-
files = [os.path.basename(f) for f in fs.ls(path)]
336+
files = [os.path.basename(f["name"]) for f in fs.listdir(path)]
337337
files = [x for x in files if name_key in x]
338338
if len(files) == 0:
339339
return 0

0 commit comments

Comments
 (0)