-
Notifications
You must be signed in to change notification settings - Fork 21
Model Batching/Domain Randomization in MuJoCoSolver #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Currently we just call |
I tend to agree. I view the selection API as an optional feature that's there for convenience rather than core functionality. |
One limitation of this batching approach is that it requires homogeneous environments. We could envision a more flexible approach that uses indexed arrays instead of a batch dimension. That comes with its own set of challenges, though. Indexed arrays are likely to be slower. Kernels may need to be overloaded to accept regular or indexed arrays. That's all doable, but it adds complexity. |
Is the motivation for stride 0 arrays to save memory? We don't do this in Newton (unless I'm missing something) and we didn't do this in previous iterations of Isaac Gym/Lab. We just used regular arrays with copies. Stride 0 arrays are cool, but they also introduce some complexity. |
Thanks for your comments - some clarifications:
In the end also for MjWarp this is a very awkward decision, which is why it has been out there for so long now, and we haven't really found something the just feels right. One final comment that is more general and should be discussed here as well - how are we going to deal with the fact that if we change the newton model, we need to update the MjWarp model again. This is a pretty important thing to get right that is kind of independent of the actual API. |
At the moment the user has to recreate the MuJoCo model from a Newton model from scratch using |
Yeah maybe it's time we think through some of that.. Ideally we don't need to use the MJC compiler at all anymore, but for sure we should aim for a solution where we will only need it during initial setup or if we change significant parameters. I can put together a doc of how this could work, and then we can see what needs changes in MjWarp and what parts are needed for newton. For the continuous stuff that can be domain-randomized it would be ideal to just have the MjWarp model and the newton model come closer together, such that we could expose some of the MjWarp arrays directly in the newton model. |
closing, replaced by #116 |
We have this PR open for discussion right now that implements model batching/domain randomization in MjWarp: google-deepmind/mujoco_warp#231. We should figure out if we can work with this.
Summary of that proposal is that the MjWarp Model will have certain fields expanded by 1 dimension at the front by default, but use stride 0 in that dimension. So without any interaction from the user, the data will be the same scalar for all model replications. Think of something link joint limits ("range") which is a
wp.array(dtype=wp.vec2i)
with shape (njnt, ) right now. This would become shape (1, njnt), and use stride 0 in the first dimension so any indexing lookup will point to the first element.The way users would randomize this now is to just replace that array with another wp.array that has shape (nworld, njnt) which contains potentially different data for each world. That array has the default strides then.
For newton as of right now, I can see a few issues I'd like to discuss:
I think this needs to work both with and without the selection API, so we cannot just build that functionality into the selection API. More so, we should not start pushing functionality other than "selection" into the API anyway.
The text was updated successfully, but these errors were encountered: