Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions mmengine/visualization/vis_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,12 +824,20 @@ def close(self) -> None:
return

file_paths = dict()
for filename in scandir(self.cfg.work_dir, self._artifact_suffix,
True):
file_path = osp.join(self.cfg.work_dir, filename)
relative_path = os.path.relpath(file_path, self.cfg.work_dir)
dir_path = os.path.dirname(relative_path)
file_paths[file_path] = dir_path
if (hasattr(self, 'cfg')
and osp.isdir(getattr(self.cfg, 'work_dir', ''))):
for filename in scandir(
self.cfg.work_dir,
self._artifact_suffix,
recursive=True,
):
file_path = str(osp.join(self.cfg.work_dir, filename))
relative_path = os.path.relpath(file_path, self.cfg.work_dir)
dir_path = os.path.dirname(relative_path)
file_paths[file_path] = dir_path
else:
warnings.warn('self.cfg.work_dir is not set, thus some '
'artifacts will not be logged')

for file_path, dir_path in file_paths.items():
self._mlflow.log_artifact(file_path, dir_path)
Expand Down