Skip to content
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

class directly calls the __init__ methods of its base classes (Model and GaussianMixin) #296

Open
AcademeMaster opened this issue Mar 18, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@AcademeMaster
Copy link

Description

Problem:
Currently, the Policy class directly calls the init methods of its base classes (Model and GaussianMixin) like this:

python

Model.init(self, observation_space, action_space, device)
GaussianMixin.init(self, clip_actions, clip_log_std, min_log_std, max_log_std, reduction)
This approach bypasses Python's cooperative multiple inheritance mechanism (using super()) and can lead to problems—especially if any of the base classes use super() in their own initializers. You might encounter issues such as multiple values for the same argument if the parameters are not managed properly.

Suggestion:
Modify the base classes (Model and GaussianMixin) so that they accept extra keyword arguments (using **kwargs) and call super().init(**kwargs). Then, update the Policy class to use a single super().init() call. This way, each class in the method resolution order (MRO) will only consume the parameters it needs, and the remaining arguments will be passed along properly.

What skrl version are you using?

1.4.1

What ML framework/library version are you using?

pytorch

Additional system information

No response

@AcademeMaster AcademeMaster added the bug Something isn't working label Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant