TensorboardLogger not handling remote filesystem paths correctly on Windows environment
#17,601 创建于 2023年5月10日
仓库指标
- Star
- (26,687 star)
- PR 合并指标
- (平均合并 9天 15小时) (30 天内合并 3 个 PR)
描述
Bug description
When attempting to use a remote filesystem, the TensorboardLogger does not handle the name and version parameters correctly. The issue seems to occur specifically when running training scripts from Windows environments. The problem arises because the os.path.join() function tries to concatenate the different URI parts using Windows backslash characters () instead of forward slashes (/).
One possible solution to avoid this issue is to first check the filesystem being used (while parsing the save_dir logger parameter) and then employ the appropriate path concatenation strategy if a remote filesystem is detected, regardless of the operating system executing the script.
What version are you seeing the problem on?
v2.0
How to reproduce the bug
Here's an example using S3 (in my case, self-hosted in a Minio Docker container):
- Run the following code from a Windows environment (ensure that my_bucket is already created, as failure to format the URI correctly may result in an InvalidBucketName issue during bucket creation):
logger = TensorBoardLogger(save_dir='s3://my_bucket/logs')
- Notice that in your 'my_bucket' bucket, there is a single folder named 'logs\lightning_logs\version_0' instead of a sequence of nested folders ('logs', 'lightning_logs', and 'version_0').
Error messages and logs
No error messages or logs are generated. In my Minio bucket, paths are not split into multiple directories as expected when using TensorboardLogger with S3. Although I haven't checked other filesystems, I believe they may suffer from the same issue. Instead of creating multiple directories, a single directory is created with a long name that includes all the subdirectories.
Environment
#- Lightning Componen: Trainer, TensorboardLogger:
#- PyTorch Lightning Version: 2.0.2
#- PyTorch Version: 1.13.1
#- Python version: 3.10.9
#- OS: Windows
#- How you installed Lightning : poetry
More info
No response
cc @awaelchli @borda @Blaizzy