Skip to content

Commit

Permalink
address #92
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed May 5, 2024
1 parent 61621ed commit 3cb1a5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions byol_pytorch/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
from beartype.typing import Optional

from accelerate import Accelerator
from accelerate.utils import DistributedDataParallelKwargs

# constants

DEFAULT_DDP_KWARGS = DistributedDataParallelKwargs(
find_unused_parameters = True
)

# functions

Expand Down Expand Up @@ -60,6 +67,10 @@ def __init__(
accelerator_kwargs: dict = dict(),
):
super().__init__()

if 'kwargs_handlers' not in accelerator_kwargs:
accelerator_kwargs['kwargs_handlers'] = [DEFAULT_DDP_KWARGS]

self.accelerator = Accelerator(**accelerator_kwargs)

if dist.is_initialized() and dist.get_world_size() > 1:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'byol-pytorch',
packages = find_packages(exclude=['examples']),
version = '0.8.0',
version = '0.8.1',
license='MIT',
description = 'Self-supervised contrastive learning made simple',
author = 'Phil Wang',
Expand Down

0 comments on commit 3cb1a5e

Please sign in to comment.