Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding breakpoint in random_images function crashes pdb #134

Open
cgebbe opened this issue May 21, 2024 · 4 comments
Open

Adding breakpoint in random_images function crashes pdb #134

cgebbe opened this issue May 21, 2024 · 4 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@cgebbe
Copy link

cgebbe commented May 21, 2024

🐛 Bug

I'd like to debug the random_images function taken from the first example. However, when adding a breakpoint() line in that function, python crashes.

Environment

  • PyTorch Version (e.g., 1.0): 2.3.0
  • OS (e.g., Linux): ubuntu 20.04
  • How you installed PyTorch (conda, pip, source): uv pip
  • Build command you used (if compiling from source): None
  • Python version: 3.11
  • CUDA/cuDNN version: cuda 12.1

Additional context

Traceback

Workers are ready ! Starting data processing...
                                                                                      > /path/to/repo/subdir/convert_zipfiles_to_litdata.py(43)random_images()
-> "index": index,  # int data type
(Pdb) 
Traceback (most recent call last):
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/data_processor.py", line 626, in _handle_data_chunk_recipe
    item_data_or_generator = self.data_recipe.prepare_item(current_item)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/functions.py", line 148, in _prepare_item
    return self._fn(item_metadata)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/repo/subdir/convert_zipfiles_to_litdata.py", line 43, in random_images
    "index": index,  # int data type
             ^^^^^
  File "/usr/lib/python3.11/bdb.py", line 90, in trace_dispatch
    return self.dispatch_line(frame)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/bdb.py", line 115, in dispatch_line
    if self.quitting: raise BdbQuit
                      ^^^^^^^^^^^^^
bdb.BdbQuit

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/data_processor.py", line 423, in run
    self._loop()
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/data_processor.py", line 472, in _loop
    self._handle_data_chunk_recipe(index)
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/data_processor.py", line 638, in _handle_data_chunk_recipe
    raise RuntimeError(f"Failed processing {self.items[index]}") from e
RuntimeError: Failed processing 0

Worker 0 is done.
Traceback (most recent call last):
  File "/path/to/repo/subdir/convert_zipfiles_to_litdata.py", line 107, in <module>
    main()
  File "/path/to/repo/subdir/convert_zipfiles_to_litdata.py", line 31, in main
    convert_zipfile_to_litdata(s3_filepath=VAL_PATH, outdir=Path.home() / "tmp/tica")
  File "/path/to/repo/subdir/convert_zipfiles_to_litdata.py", line 67, in convert_zipfile_to_litdata
    litdata.optimize(
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/functions.py", line 358, in optimize
    data_processor.run(
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/data_processor.py", line 981, in run
    self._exit_on_error(error)
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/data_processor.py", line 1040, in _exit_on_error
    raise RuntimeError(f"We found the following error {error}.")
RuntimeError: We found the following error Traceback (most recent call last):
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/data_processor.py", line 626, in _handle_data_chunk_recipe
    item_data_or_generator = self.data_recipe.prepare_item(current_item)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/functions.py", line 148, in _prepare_item
    return self._fn(item_metadata)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/repo/subdir/convert_zipfiles_to_litdata.py", line 43, in random_images
    "index": index,  # int data type
             ^^^^^
  File "/usr/lib/python3.11/bdb.py", line 90, in trace_dispatch
    return self.dispatch_line(frame)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/bdb.py", line 115, in dispatch_line
    if self.quitting: raise BdbQuit
                      ^^^^^^^^^^^^^
bdb.BdbQuit

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/data_processor.py", line 423, in run
    self._loop()
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/data_processor.py", line 472, in _loop
    self._handle_data_chunk_recipe(index)
  File "/path/to/repo/.venv/lib/python3.11/site-packages/litdata/processing/data_processor.py", line 638, in _handle_data_chunk_recipe
    raise RuntimeError(f"Failed processing {self.items[index]}") from e
RuntimeError: Failed processing 0
@cgebbe cgebbe added bug Something isn't working help wanted Extra attention is needed labels May 21, 2024
Copy link

Hi! thanks for your contribution!, great first issue!

@tchaton
Copy link
Collaborator

tchaton commented May 26, 2024

@cgebbe
Copy link
Author

cgebbe commented May 27, 2024

@tchaton : Thanks, I'll give it a try next time, wasn't aware of that!

@tchaton
Copy link
Collaborator

tchaton commented May 30, 2024

@cgebbe If you try it, can you let me know. Maybe worth to copy the code from lightning to litdata if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants