meta-pytorch / meta-pytorch/data

[RFC] Remove the need for super().__init__() call in BaseNode subclasses to better support dataclasses

Open
#1,411 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

nodes
Dominant language
Python
Stars
1.3k
Forks
179
Avg merge
6d 1h
Merged PRs (30d)
2

Description

🚀 The feature

Stop requiring BaseNode implementations to call super().init()

Motivation, pitch

Currently we require users to call super().init() but this can't be done easily with dataclasses, except in post_init. See eg nn.Module:

image
Alternatives

We could just leave it as-is, since DataClasses have a viable workaround with __post_init__. Right now we're only setting up a flag but it may be useful for other things in the future, such as registration with a global thread executor. Alternatively we could use a Loader wrapper class to register with an executor.

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by locating BaseNode, its subclasses, and the current super().init() flag setup, then compare dataclass initialization and the alternatives described in the RFC. Done means a decided design and implementation that removes the required call without breaking existing subclasses.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.