Lightning-AI / Lightning-AI/pytorch-lightning
Profiler Error: record.__enter__() missing 1 equired
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 31.4k
- Forks
- 3.8k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 6
Description
### Bug description

### What version are you seeing the problem on?
v2.1
### How to reproduce the bug
just set the profiler like this:
`schedule_config = {'wait': 10, 'warmup': 1, 'active': 1, 'repeat': 1}
profiler = PyTorchProfiler( dirpath=save_dir, filename=filename, record_shapes=True, with_stack=True, with_flops=True, with_modules=True, schedule=torch.profiler.schedule(**schedule_config))
trainer = pl.Trainer( .... profiler=profiler)`
### Error messages and logs
```
# Error messages and logs here please
```

### Environment
Current environment
```
- Lightning Component Trainer
- PyTorch Lightning Version 2.0.8:
#- Lightning App Version (e.g., 0.5.2):
- PyTorch Version (e.g., 2.1.1):
- Python version (e.g., 3.9):
- OS :Linux
- CUDA/cuDNN version: 11.8
#- GPU models and configuration:
- How you installed Lightning pip
- Running environment of LightningApp (e.g. local, cloud): cloud
```
### More info
_No response_
cc @carmocca
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 by reproducing the reported configuration with PyTorchProfiler and the supplied torch.profiler schedule on the stated Lightning and PyTorch versions. Trace where the profiler context is entered when the schedule becomes active, then verify that the configuration completes without the reported record.__enter__() error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100