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

[FEATURE REQUEST] Rewrite training code based on PyTorch Lightning #322

Open
Jn-Huang opened this issue Sep 30, 2022 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@Jn-Huang
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Using lightning can simplify our implementation of models, training, etc. The idea is from @xingjian-zhang. I am still going through the tutorials of lightning.

We may end up with a trainer class similar to this one:
https://github.com/intel-analytics/BigDL/blob/main/python/nano/src/bigdl/nano/pytorch/trainer/Trainer.py

@Jn-Huang Jn-Huang added the enhancement New feature or request label Sep 30, 2022
@xingjian-zhang
Copy link
Collaborator

xingjian-zhang commented Oct 3, 2022

The Trainer class is a bit complicated to me. Do we really need to implement a trainer here? My initial idea was, for each kind of task, to implement a subclass of pl.LightningModule that at least reloads/implements the following member functions:

  1. forward
  2. training_step
  3. validation_step
  4. test_step
  5. configure_optimizers
    We may want to add other functions by need, too.

Therefore, the training script will contain these components:

  1. A subclass of pl.LightningModule
  2. Class of GNN(s) (either imported or implemented)
  3. A main function that
    1. Instantiates 1 and 2
    2. Gets the dataloader
    3. Instantiates a pl.Trainer to fit train data
    4. Reports results on test data

See details at https://pytorch-lightning.readthedocs.io/en/stable/common/lightning_module.html

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

No branches or pull requests

2 participants