google-deepmind / dm_robotics

Libraries, tools and tasks created and used at DeepMind Robotics.
Apache License 2.0
332 stars 32 forks source link

TaskEntitiesInitializer - accounting for different initializer function signatures #20

Open peterdavidfagan opened 8 months ago

peterdavidfagan commented 8 months ago

In the current implementation, an entity initializer within the TaskEntitiesInitializer assumes the following args physics: mjcf.Physics and random_state: np.random.RandomState.

There are cases where initializers may accept optional args such as this initializer.

One option to solve this is to add kwargs to the task entity initializer and check for their presence in the __call__ function signature for a given initializer (this seems super unclean).

Adding this issue for reference as I have come across a case where I actually want to use an optional arg with my initializer. For now I am solving by fixing the optional arg in my initializer to the default value I want but it would likely be better to revise the task entities initializer API to handle this use case.

shacklestone commented 8 months ago

Thanks for letting us know, Peter.