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

Remove all __post_init__ from Component/Model subclasses. #2064

Open
jieguangzhou opened this issue May 17, 2024 · 1 comment
Open

Remove all __post_init__ from Component/Model subclasses. #2064

jieguangzhou opened this issue May 17, 2024 · 1 comment

Comments

@jieguangzhou
Copy link
Collaborator

When implementing a new class, we use post_init to handle initialization logic. However, we must not call parent class methods.

def __post_init__(self, db, artifacts):
    super().__post_init__(db, artifacts)

This is unnecessary for overriding a new class.

We can remove the initialization of post_init in the ext module and use the init function instead.

Ultimately, we only need to implement three methods:

•	init (optional)
•	predict_one
•	predict

Additionally, we can use init for lazy loading, performing initialization only during actual function calls.

@blythed
Copy link
Collaborator

blythed commented May 17, 2024

Agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants