Lightning-AI / Lightning-AI/pytorch-lightning
[Trainer] dictionary access to multiple named loggers
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 31.4k
- Forks
- 3.8k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 6
Description
## 🚀 Feature
When using multiple loggers, being able to give a dict of loggers to the `Trainer()` instead of a list.
### Motivation
I find the current list access when calling a single logger not explicit.
### Pitch
```python
trainer = Trainer(
logger={
'tensorboard': TensorBoardLogger(...),
'csv': CSVLogger(...)},
...
)
```
then in the loop:
```python
self.logger['tensorboard'].experiment.add_image(...)
```
instead of
```python
self.logger[0].experiment.add_image(...)
```
There could be an ambiguity when using an integer as key, so maybe enforce string-only keys.
cc @borda @awaelchli @edward-io @ananthsub @rohitgr7 @kamil-kaczmarek @Raalsky @Blaizzy @justusschock @kaushikb11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Trainer() logger argument and follow how the current list of loggers becomes self.logger. Compare the proposed dictionary access for named TensorBoardLogger and CSVLogger instances, including the unresolved integer-key ambiguity. Done means multiple named loggers can be passed and accessed by string key without breaking existing logger behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100