alex-petrenko / sample-factory

High throughput synchronous and asynchronous reinforcement learning
https://samplefactory.dev
MIT License
773 stars 106 forks source link

Debug v1 of sample factory #299

Open Abc11c opened 1 month ago

Abc11c commented 1 month ago

Hi @alex-petrenko,

Thank you for such a great code!

I'm working on some RL algorithms (intrinsic reward-based ones for the MiniGrid environment) based on the version here.

I was wondering if there are any tricks for debugging the code, specifically on how to synchronize the threads, similar to the current version as seen in the serial mode.

I can't get breakpoint() to work because of threading, which makes it hard to debug.

Any pointers would help. Thanks!

Best regards, Ashwath

alex-petrenko commented 1 month ago

@Abc11c thank you for using the code!

Generally, I didn't have many issues debugging the version 1 (nor the non-serial V2 for that matter) You don't want to rely on things like breakpoint(), pdb, or ipdb. Just set up any modern IDE (both PyCharm and VSCode would work) and use the visual debugging functionality.

These IDEs use special scripts to orchestrate multi-process debugging, it's a huge quality-of-life improvement.