Lightning-AI / Lightning-AI/pytorch-lightning

Profiler Error: record.__enter__() missing 1 equired

Open
#19,253 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug profiler torch.compile ver: 2.1.x
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Bug description

![image](https://github.com/Lightning-AI/pytorch-lightning/assets/51102941/45b2751c-b274-49bf-b15d-9bf77dfb0deb)

### 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
```

![image](https://github.com/Lightning-AI/pytorch-lightning/assets/51102941/45b2751c-b274-49bf-b15d-9bf77dfb0deb)

### 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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.