litdata icon indicating copy to clipboard operation
litdata copied to clipboard

Profiler patches torch without reverting it

Open awaelchli opened this issue 1 year ago • 4 comments

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

awaelchli avatar Jul 17 '24 16:07 awaelchli

You are right !

tchaton avatar Jul 17 '24 20:07 tchaton

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.

stale[bot] avatar Apr 16 '25 05:04 stale[bot]

@bhimrazy is this still an issue?

Borda avatar Jun 11 '25 13:06 Borda

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

bhimrazy avatar Jun 12 '25 07:06 bhimrazy