Repository navigation
Conversation
step_async ran the whole step and cached the result, so the split the sb3 VecEnv API expects did not exist: a caller doing step_async then step_wait paid the receive cost inside step_async. The send loop now lives in step_async, the receive loop in step_wait, and step calls the two in order. Results are unchanged. Actions still reach every environment before the first receive, so the existing overlap between the parallel games is preserved.
The rllib CI jobs uninstall stable_baselines3 before running the suite, so a module level import of the sb3 wrapper turns into a pytest collection error and takes the whole run down. Import the wrapper inside the helper that builds the env and skip the module when ray is present, as the other sb3 tests already do.
SBGSingleObsEnv only overrode step(), which worked because step_async used to be self.results = self.step(actions), a virtual call. Now that step_async and step_wait do the work themselves, sb3 never enters the subclass step(): VecEnv.step calls the pair, VecEnvWrapper forwards step_async and VecMonitor forwards step_wait. examples/sb3_imitation.py wraps SBGSingleObsEnv in VecMonitor and trains an MlpPolicy, so it would receive the dict observation instead of the array behind obs_key, and lose the terminal_observation the imitation path needs. Override step_wait instead, which both the async pair and the inherited step() now go through. The test drives the subclass through a real VecMonitor and fails without this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
step_asynccurrently runs the whole step and caches the result:So the split the
VecEnvAPI is built around is not there. A caller that doesstep_async, gets on with something else, then callsstep_waitstill pays the whole receive cost insidestep_async.This moves the send loop into
step_async, the receive loop intostep_wait, and leavesstepas the two called in order.GodotEnvalready exposesstep_sendandstep_recv, so nothing changes on the protocol or plugin side.Results are identical and actions still reach every game before the first receive, so the existing overlap between parallel instances is preserved. The tests pin the call order and check that
stepmatchesstep_asyncfollowed bystep_wait.