mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-11 12:31:23 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c00c4a3cd | ||
|
|
3b9e97fb96 | ||
|
|
438a4f74d0 | ||
|
|
d0a9c92326 | ||
|
|
d0a2438e22 | ||
|
|
4e1c90d892 | ||
|
|
dccab6ce19 | ||
|
|
602236ecf2 | ||
|
|
f1caeb49cc | ||
|
|
1c45edd192 | ||
|
|
dd85e1c600 | ||
|
|
ae8f6866bb | ||
|
|
35d85b2de1 | ||
|
|
d63c19539f | ||
|
|
0d86302e05 | ||
|
|
d179ad6d1d | ||
|
|
221c10c8c3 | ||
|
|
90faf9118c | ||
|
|
a00e24ed80 | ||
|
|
5c99da5861 | ||
|
|
d3ca836024 | ||
|
|
d6c79644af | ||
|
|
56179bdbbb | ||
|
|
a3df04f049 | ||
|
|
170262ff73 | ||
|
|
18f58d4bf4 | ||
|
|
7b982f2280 | ||
|
|
7b5a40b170 | ||
|
|
e7f15e4e89 | ||
|
|
c0c1cf058f | ||
|
|
6be5fb3cf7 | ||
|
|
45f36d3e74 | ||
|
|
0994cd9b09 | ||
|
|
f02856c0bc | ||
|
|
67de4c241e | ||
|
|
a7e154e643 | ||
|
|
f2fb219bfe | ||
|
|
e2bf0cda07 | ||
|
|
149628a003 | ||
|
|
ac4216f95c |
@@ -65,12 +65,12 @@ You can override this method to adjust how you do the optimizer step for each op
|
|||||||
Called once per optimizer
|
Called once per optimizer
|
||||||
```python
|
```python
|
||||||
# DEFAULT
|
# DEFAULT
|
||||||
def optimizer_step(self, current_epoch, batch_nb, optimizer, optimizer_i):
|
def optimizer_step(self, current_epoch, batch_nb, optimizer, optimizer_i, second_order_closure=None):
|
||||||
optimizer.step()
|
optimizer.step()
|
||||||
optimizer.zero_grad()
|
optimizer.zero_grad()
|
||||||
|
|
||||||
# Alternating schedule for optimizer steps (ie: GANs)
|
# Alternating schedule for optimizer steps (ie: GANs)
|
||||||
def optimizer_step(self, current_epoch, batch_nb, optimizer, optimizer_i):
|
def optimizer_step(self, current_epoch, batch_nb, optimizer, optimizer_i, second_order_closure=None):
|
||||||
# update generator opt every 2 steps
|
# update generator opt every 2 steps
|
||||||
if optimizer_i == 0:
|
if optimizer_i == 0:
|
||||||
if batch_nb % 2 == 0 :
|
if batch_nb % 2 == 0 :
|
||||||
@@ -91,7 +91,7 @@ This step allows you to do a lot of non-standard training tricks such as learnin
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
# learning rate warm-up
|
# learning rate warm-up
|
||||||
def optimizer_step(self, current_epoch, batch_nb, optimizer, optimizer_i):
|
def optimizer_step(self, current_epoch, batch_nb, optimizer, optimizer_i, second_order_closure=None):
|
||||||
# warm up lr
|
# warm up lr
|
||||||
if self.trainer.global_step < 500:
|
if self.trainer.global_step < 500:
|
||||||
lr_scale = min(1., float(self.trainer.global_step + 1) / 500.)
|
lr_scale = min(1., float(self.trainer.global_step + 1) / 500.)
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ class TestTubeLogger(LightningLoggerBase):
|
|||||||
__test__ = False
|
__test__ = False
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, save_dir, name="default", debug=False, version=None, create_git_tag=False
|
self, save_dir, name="default", description=None, debug=False,
|
||||||
|
version=None, create_git_tag=False
|
||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.save_dir = save_dir
|
self.save_dir = save_dir
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.description = description
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
self._version = version
|
self._version = version
|
||||||
self.create_git_tag = create_git_tag
|
self.create_git_tag = create_git_tag
|
||||||
@@ -29,6 +31,7 @@ class TestTubeLogger(LightningLoggerBase):
|
|||||||
name=self.name,
|
name=self.name,
|
||||||
debug=self.debug,
|
debug=self.debug,
|
||||||
version=self.version,
|
version=self.version,
|
||||||
|
description=self.description,
|
||||||
create_git_tag=self.create_git_tag,
|
create_git_tag=self.create_git_tag,
|
||||||
rank=self.rank,
|
rank=self.rank,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -659,11 +659,12 @@ class Trainer(TrainerIO):
|
|||||||
"""
|
"""
|
||||||
warnings.warn(msg)
|
warnings.warn(msg)
|
||||||
|
|
||||||
if on_ddp and self.get_val_dataloaders is not None:
|
if on_ddp and self.get_val_dataloaders() is not None:
|
||||||
for dataloader in self.get_val_dataloaders():
|
for dataloader in self.get_val_dataloaders():
|
||||||
if not isinstance(dataloader.sampler, DistributedSampler):
|
if not isinstance(dataloader.sampler, DistributedSampler):
|
||||||
msg = """
|
msg = """
|
||||||
Your val_dataloader(s) don't use DistributedSampler.
|
Your val_dataloader(s) don't use DistributedSampler.
|
||||||
|
|
||||||
You're using multiple gpus and multiple nodes without using a
|
You're using multiple gpus and multiple nodes without using a
|
||||||
DistributedSampler to assign a subset of your data to each process.
|
DistributedSampler to assign a subset of your data to each process.
|
||||||
To silence this warning, pass a DistributedSampler to your DataLoader.
|
To silence this warning, pass a DistributedSampler to your DataLoader.
|
||||||
@@ -682,11 +683,12 @@ class Trainer(TrainerIO):
|
|||||||
warnings.warn(msg)
|
warnings.warn(msg)
|
||||||
break
|
break
|
||||||
|
|
||||||
if on_ddp and self.get_test_dataloaders is not None:
|
if on_ddp and self.get_test_dataloaders() is not None:
|
||||||
for dataloader in self.get_test_dataloaders():
|
for dataloader in self.get_test_dataloaders():
|
||||||
if not isinstance(dataloader.sampler, DistributedSampler):
|
if not isinstance(dataloader.sampler, DistributedSampler):
|
||||||
msg = """
|
msg = """
|
||||||
Your test_dataloader(s) don't use DistributedSampler.
|
Your test_dataloader(s) don't use DistributedSampler.
|
||||||
|
|
||||||
You're using multiple gpus and multiple nodes without using a
|
You're using multiple gpus and multiple nodes without using a
|
||||||
DistributedSampler to assign a subset of your data to each process.
|
DistributedSampler to assign a subset of your data to each process.
|
||||||
To silence this warning, pass a DistributedSampler to your DataLoader.
|
To silence this warning, pass a DistributedSampler to your DataLoader.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from setuptools import setup, find_packages
|
|||||||
# engineer specific practices
|
# engineer specific practices
|
||||||
setup(
|
setup(
|
||||||
name='pytorch-lightning',
|
name='pytorch-lightning',
|
||||||
version='0.5.1',
|
version='0.5.1.2',
|
||||||
description='The Keras for ML researchers using PyTorch',
|
description='The Keras for ML researchers using PyTorch',
|
||||||
author='William Falcon',
|
author='William Falcon',
|
||||||
author_email='waf2107@columbia.edu',
|
author_email='waf2107@columbia.edu',
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ def test_gradient_accumulation_scheduling():
|
|||||||
assert Trainer(accumulate_grad_batches={1: 2.5, 3: 5})
|
assert Trainer(accumulate_grad_batches={1: 2.5, 3: 5})
|
||||||
|
|
||||||
# test optimizer call freq matches scheduler
|
# test optimizer call freq matches scheduler
|
||||||
def optimizer_step(self, epoch_nb, batch_nb, optimizer, optimizer_i):
|
def optimizer_step(self, epoch_nb, batch_nb, optimizer, optimizer_i, second_order_closure=None):
|
||||||
# only test the first 12 batches in epoch
|
# only test the first 12 batches in epoch
|
||||||
if batch_nb < 12:
|
if batch_nb < 12:
|
||||||
if epoch_nb == 0:
|
if epoch_nb == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user