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

Launching fails in non-distributed environments because of default args #152

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion inplace_abn/abn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import torch.nn.functional as functional

from .functions import *
_default_group = distributed.group.WORLD if hasattr(distributed, "group") else None


class ABN(nn.Module):
Expand Down Expand Up @@ -138,7 +139,7 @@ class InPlaceABNSync(ABN):
"""

def __init__(self, num_features, eps=1e-5, momentum=0.1, affine=True, activation="leaky_relu",
activation_param=0.01, group=distributed.group.WORLD):
activation_param=0.01, group=_default_group):
super(InPlaceABNSync, self).__init__(num_features, eps, momentum, affine, activation, activation_param)
self.group = group

Expand Down
3 changes: 2 additions & 1 deletion inplace_abn/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from torch.autograd.function import once_differentiable

from . import _backend
_default_group = distributed.group.WORLD if hasattr(distributed, "group") else None


def _activation_from_name(activation):
Expand Down Expand Up @@ -152,7 +153,7 @@ def inplace_abn(x, weight, bias, running_mean, running_var,

def inplace_abn_sync(x, weight, bias, running_mean, running_var,
training=True, momentum=0.1, eps=1e-05, activation="leaky_relu", activation_param=0.01,
group=distributed.group.WORLD):
group=_default_group):
return InPlaceABN.apply(x, weight, bias, running_mean, running_var,
training, momentum, eps, activation, activation_param, group)

Expand Down