mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-10-03 12:50:15 +08:00
update Docs [links & formatting] (#769)
* wip * wip * debug imports docs formatting * WIP * formatting * fix setup
This commit is contained in:
1 parent
bfbb4a6279
commit
5130841bef
23 files changed
+79
-78
No files matched your search
@@ -43,6 +43,7 @@ Normally, we want to let the `__main__` function start the training.
|
||||
|
||||
The main function is your entry into the program. This is where you init your model, checkpoint directory,
|
||||
and launch the training. The main function should have 3 arguments:
|
||||
|
||||
- hparams: a configuration of hyperparameters.
|
||||
- slurm_manager: Slurm cluster manager object (can be None)
|
||||
- dict: for you to return any values you want (useful in meta-learning, otherwise set to)
|
||||
|
||||
@@ -7,8 +7,8 @@ from argparse import ArgumentParser
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
import pytorch_lightning as pl
|
||||
from pl_examples.basic_examples.lightning_module_template import LightningTemplateModel
|
||||
from pytorch_lightning import Trainer
|
||||
|
||||
SEED = 2334
|
||||
torch.manual_seed(SEED)
|
||||
@@ -28,7 +28,7 @@ def main(hparams):
|
||||
# ------------------------
|
||||
# 2 INIT TRAINER
|
||||
# ------------------------
|
||||
trainer = Trainer()
|
||||
trainer = pl.Trainer()
|
||||
|
||||
# ------------------------
|
||||
# 3 START TRAINING
|
||||
|
||||
@@ -7,8 +7,8 @@ from argparse import ArgumentParser
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
import pytorch_lightning as pl
|
||||
from pl_examples.basic_examples.lightning_module_template import LightningTemplateModel
|
||||
from pytorch_lightning import Trainer
|
||||
|
||||
SEED = 2334
|
||||
torch.manual_seed(SEED)
|
||||
@@ -28,7 +28,7 @@ def main(hparams):
|
||||
# ------------------------
|
||||
# 2 INIT TRAINER
|
||||
# ------------------------
|
||||
trainer = Trainer(
|
||||
trainer = pl.Trainer(
|
||||
gpus=hparams.gpus,
|
||||
distributed_backend=hparams.distributed_backend,
|
||||
use_amp=hparams.use_16bit
|
||||
|
||||
@@ -16,10 +16,9 @@ from torch.utils.data.distributed import DistributedSampler
|
||||
from torchvision.datasets import MNIST
|
||||
|
||||
import pytorch_lightning as pl
|
||||
from pytorch_lightning.core.lightning import LightningModule
|
||||
|
||||
|
||||
class LightningTemplateModel(LightningModule):
|
||||
class LightningTemplateModel(pl.LightningModule):
|
||||
"""
|
||||
Sample model to show how to define a template
|
||||
"""
|
||||
|
||||
@@ -7,8 +7,8 @@ from argparse import ArgumentParser
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
import pytorch_lightning as pl
|
||||
from pl_examples.basic_examples.lightning_module_template import LightningTemplateModel
|
||||
from pytorch_lightning import Trainer
|
||||
|
||||
SEED = 2334
|
||||
torch.manual_seed(SEED)
|
||||
@@ -29,7 +29,7 @@ def main(hparams):
|
||||
# ------------------------
|
||||
# 2 INIT TRAINER
|
||||
# ------------------------
|
||||
trainer = Trainer(
|
||||
trainer = pl.Trainer(
|
||||
gpus=2,
|
||||
num_nodes=2,
|
||||
distributed_backend='ddp2'
|
||||
|
||||
@@ -7,8 +7,8 @@ from argparse import ArgumentParser
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
import pytorch_lightning as pl
|
||||
from pl_examples.basic_examples.lightning_module_template import LightningTemplateModel
|
||||
from pytorch_lightning import Trainer
|
||||
|
||||
SEED = 2334
|
||||
torch.manual_seed(SEED)
|
||||
@@ -29,7 +29,7 @@ def main(hparams):
|
||||
# ------------------------
|
||||
# 2 INIT TRAINER
|
||||
# ------------------------
|
||||
trainer = Trainer(
|
||||
trainer = pl.Trainer(
|
||||
gpus=2,
|
||||
num_nodes=2,
|
||||
distributed_backend='ddp'
|
||||
|
||||
Reference in new issue
Block a user