Lightning-AI / Lightning-AI/pytorch-lightning

`log_dir` contains both forward and backward slashes as path separator when using remote file location as `default_root_dir` on windows

Open
#19,729 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug trainer: argument
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Bug description

I am running on Windows OS and storing logs and artifacts on remote location (AWS S3).

```python
path_pl_logs = f"s3://{bucket_name}/pytorch-lightning-logs/{experiment_name}"
trainer = pl.Trainer(
accelerator="gpu",
devices=1,
max_epochs=checkpoint_n_epoch,
default_root_dir=path_pl_logs,
)
```

With the following output containing a mixture of forward and backward slashes. This causes problems with the folder structure.
```python
trainer.log_dir
>> s3://{bucket_name}/pytorch-lightning-logs/{experiment_name}\lightning_logs\version_0
```

Ideally when using a remote location it would not use os.path.join to create folder/filenames but instead just use a forward slash file separator.

### What version are you seeing the problem on?

v2.2

### How to reproduce the bug

_No response_

### Error messages and logs

```
# Error messages and logs here please
```

### Environment

Current environment

```
#- Lightning Component (e.g. Trainer, LightningModule, LightningApp, LightningWork, LightningFlow): Trainer
#- PyTorch Lightning Version (e.g., 1.5.0): 2.2.1
#- Lightning App Version (e.g., 0.5.2):
#- PyTorch Version (e.g., 2.0): 2.2.2
#- Python version (e.g., 3.9): 3.11
#- OS (e.g., Linux): Windows 11
#- CUDA/cuDNN version: 12.1
#- GPU models and configuration: NVIDIA RTX A2000 Laptop GPU
#- How you installed Lightning(`conda`, `pip`, source): pipenv
#- Running environment of LightningApp (e.g. local, cloud): local
```

### More info

_No response_

cc @justusschock @lantiga @borda

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Trainer.log_dir path construction used when default_root_dir points to an S3 location, and inspect how Windows path separators are applied to the remote path. Done means the resulting remote log path uses consistent forward-slash separators instead of mixing forward and backward slashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.