Update README.md

This commit is contained in:
William Falcon 2019-08-08 11:03:12 -04:00 committed by GitHub
parent 3d23a56ed2
commit fcea3971a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -117,12 +117,23 @@ class CoolModel(pl.LightningModule):
2. Fit with a [trainer](https://williamfalcon.github.io/pytorch-lightning/Trainer/) 2. Fit with a [trainer](https://williamfalcon.github.io/pytorch-lightning/Trainer/)
```python ```python
from pytorch_lightning import Trainer from pytorch_lightning import Trainer
from test_tube import Experiment
model = CoolModel() model = CoolModel()
# most basic trainer, uses good defaults
trainer = Trainer()
trainer.fit(model)
```
Or with tensorboard logger and some options turned on such as multi-gpu, etc...
```python
from test_tube import Experiment
# PyTorch summarywriter with a few bells and whistles
exp = Experiment(save_dir=os.getcwd()) exp = Experiment(save_dir=os.getcwd())
# train on cpu using only 10% of the data (for demo purposes) # train on cpu using only 10% of the data (for demo purposes)
# pass in experi
trainer = Trainer(experiment=exp, max_nb_epochs=1, train_percent_check=0.1) trainer = Trainer(experiment=exp, max_nb_epochs=1, train_percent_check=0.1)
# train on 4 gpus # train on 4 gpus
@ -137,7 +148,7 @@ trainer.fit(model)
# view tensorflow logs # view tensorflow logs
print('View tensorboard logs by running\ntensorboard --logdir %s' % os.getcwd()) print('View tensorboard logs by running\ntensorboard --logdir %s' % os.getcwd())
print('and going to http://localhost:6006 on your browser') print('and going to http://localhost:6006 on your browser')
``` ```
## What does lightning control for me? ## What does lightning control for me?