litdata
litdata copied to clipboard
Profiler patches torch without reverting it
🐛 Bug
LitData patches the worker loop in torch here
https://github.com/Lightning-AI/litdata/blob/5d6b8f962a5dce5efc132131fff46f33c7e24fca/src/litdata/streaming/dataloader.py#L454-L456
but this never gets reverted. Subsequent runs with a dataloader will just happily run this worker loop. This hack should be removed, or if it stays it should have a way for it to remain disabled and be idempotent.
This could lead to hard to debug issues on the user's side. On our side, this currently leads to interactions in our test suite.
You are right !
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@bhimrazy is this still an issue?
@Borda Currently, we have a check in place to patch only when profiling is enabled:
https://github.com/Lightning-AI/litData/blob/46a40496a354555e6f3c8a18f157583a92830efb/src/litdata/streaming/dataloader.py#L473-L478
That said, it might still be worth revisiting this to find a cleaner or more robust solution.