lerobot icon indicating copy to clipboard operation
lerobot copied to clipboard

Optimize pi0 for torch.compile

Open IrvingF7 opened this issue 10 months ago • 1 comments

What this does

Original code use loss.item(), which creates a scalar. Thus, if we call torch.compile() on this policy, the computational graph will break, and PyTorch will issue a warning regarding performance degradation

How it was tested

Initialize the model and then call torch.compile on it. See that there is no longer warnings about graph break.

IrvingF7 avatar Feb 14 '25 14:02 IrvingF7

Sorry, I forgot to mention that this happened under using DDP to wrap around the compiled PI0Policy. I am not sure about the single-card situation, and I will try it when I have time later today or tmr.

IrvingF7 avatar Feb 14 '25 16:02 IrvingF7

This PR has been automatically marked as stale because it has not had recent activity (6 months). It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 15 '25 02:10 github-actions[bot]

This PR was closed because it has been stalled for 21 days with no activity. Feel free to reopen if is still relevant, or to ping a collaborator if you have any questions.

github-actions[bot] avatar Nov 05 '25 02:11 github-actions[bot]