thuml/depyf

[Bug]: vscode python debugger just exit without pausing for debugging

Closed this issue · 2 comments

Your current environment

PyTorch version: 2.4.1+cpu

Python version: 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0] (64-bit runtime)
Python platform: Linux-5.15.0-122-generic-x86_64-with-glibc2.35

Versions of relevant libraries:
[pip3] depyf==0.17.0
[pip3] torch==2.4.1+cpu
[conda] torch                     2.4.1+cpu                pypi_0    pypi

🐛 Describe the bug

Use vscode to debug the following code and the program output the message and just exit without pause for debugging as following:

Screenshot from 2024-10-16 16-22-43

However, when I used pdb, it's OK to pause and show pdb prompt.

# test.py
import torch
from torch import _dynamo as torchdynamo
from typing import List

@torch.compile
def toy_example(a, b):
   x = a / (torch.abs(a) + 1)
   if b.sum() < 0:
       b = b * -1
   return x * b

def main():
   for _ in range(100):
       toy_example(torch.randn(10), torch.randn(10))

if __name__ == "__main__":
   import depyf
   with depyf.prepare_debug("depyf_debug_dir"):
       main()
   with depyf.debug():
       main()

@youkaichao Could you help to check this issue? thanks!

thanks for your interest!

this looks like a known issue of vscode debugger, see microsoft/debugpy#1410

I only use pdb for that reason.