Fix CPU training slowdown by introducing train_freq - #45
google-labs-jules[bot] wants to merge 2 commits into
Conversation
Added a `train_freq` parameter to `OptimizationConfig` to allow skipping the `agent.optimize_model()` call in the main training loop in `trainer.py`. This is especially useful for CPU-only single-agent setups where the optimizer otherwise blocks the game loop on every step, reducing throughput drastically. Also documented this use case in the README.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Hi @jules The 1. Do not reduce
|
Thank you for the detailed feedback! I have implemented the following changes to address your points:
|
- Removed suggestion to change target_update_freq from README - Added validation for train_freq in OptimizationConfig.__post_init__ - Corrected README wording to clarify optimizer skipping - Added --train-freq CLI option - Added tests for train_freq validation and modulo logic
This PR addresses the issue where CPU-only, single-agent training throughput drops to ~1 step/sec after the replay buffer warms up.
Changes made:
train_freqparameter toOptimizationConfiginconfig.pywith a default of 1 for GPU use cases.trainer.pyto only invokeagent.optimize_model()iftotal_steps % cfg.opt.train_freq == 0.train_freq = 4andtarget_update_freq = 2500) for CPU-only training inREADME.md.PR created automatically by Jules for task 509645655834908047 started by @dzaczek