Lightning-AI / Lightning-AI/pytorch-lightning

PyTorch Lightning: Slower Training Speed with CSVLogger, Can Asynchronous Logging be Configured?

Open
#19,240 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature logger: csv
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Description & Motivation

I am currently using PyTorch Lightning for training, and I'm using the CSVLogger callback to record the metric values during training to a CSV file. However, I've noticed that enabling CSVLogger and starting the training process significantly slows down the overall training speed.

I suspect that this slowdown might be caused by the default synchronous writing of metric values to the CSV file by CSVLogger, which could introduce delays due to IO operations. In order to optimize the training speed, I would like to know if there is a way to configure CSVLogger in PyTorch Lightning to perform asynchronous logging.

Therefore, I'm interested in learning how to configure CSVLogger to perform asynchronous logging, which could potentially improve the training speed.

If anyone has any experience or suggestions on how to configure CSVLogger for asynchronous logging in PyTorch Lightning, I would greatly appreciate it. Thank you very much!

test

### Pitch

_No response_

### Alternatives

_No response_

### Additional context

_No response_

cc @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 by locating the CSVLogger entry point and reviewing how it writes metric values during training. Determine whether asynchronous logging can be configured, and validate that the change avoids the reported slowdown without losing metric records.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.