-
Notifications
You must be signed in to change notification settings - Fork 302
Add dilate option and MultiNodeBatchNormalization to Conv2DActiv and Conv2DBNActiv #494
Conversation
…ltiNodeBatchNormalization in Conv2DBNActiv when a communicator is given
except for :obj:`activ` and :obj:`bn_kwargs`. | ||
except for :obj:`activ`, :obj:`bn_kwargs`, and :obj:`comm`. | ||
:obj:`comm` is a communicator of ChainerMN which is used for | ||
:obj:`MultiNodeBatchNormalization`. If :obj:`None` is given to the argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:class:`chainermn.links.MultiNodeBatchNormalization`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
If a ChainerMN communicator is given, | ||
:obj:`~chainermn.links.MultiNodeBatchNormalization` will be used | ||
for the batch normalization. If :obj:`None`, | ||
:obj:`~chainer.links.BatchNormalization` will be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to take comm
as an element of bn_kwargs
because comm
is used only for batchnorm.
If 'comm' in bn_kwargs
, it use MultiNodeBatchNormalization
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I changed it
:obj:`MultiNodeBatchNormalization`. If :obj:`None` is given to the argument | ||
:obj:`comm`, :obj:`BatchNormalization` link from Chainer is used. | ||
:class:`chainermn.links.MultiNodeBatchNormalization`. If | ||
:obj:`None` is given to the argument :obj:`comm`, :obj:`BatchNormalization` link from Chainer is used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:class:`chainer.links.BatchNormalization`
self.bn = MultiNodeBatchNormalization( | ||
out_channels, comm, **bn_kwargs) | ||
out_channels, [**bn_kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[
?
If a ChainerMN communicator is given, | ||
:class:`chainer.links.BatchNormalization`. If a ChainerMN | ||
communicator (:class:`~chainermn.communicators.CommunicatorBase) | ||
is given with the key :obj:`comm`, | ||
:obj:`~chainermn.links.MultiNodeBatchNormalization` will be used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:class:`chainermn.links.MultiNodeBatchNormalization`
try: | ||
from chainermn.links import MultiNodeBatchNormalization | ||
_chainermn_available = True | ||
except (ImportError, TypeError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does TypeError occur?
If not, we can remove it.
stride=1, pad=0, nobias=True, initialW=None, | ||
initial_bias=None, activ=relu, bn_kwargs=dict()): | ||
stride=1, pad=0, dilate=1, nobias=True, initialW=None, | ||
initial_bias=None, activ=relu, bn_kwargs=dict(), comm=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove comm
option?
self.in_channels, self.out_channels, self.ksize, self.stride, | ||
self.pad, self.dilate, initialW=initialW, | ||
initial_bias=initial_bias, activ=activ, bn_kwargs=bn_kwargs, | ||
comm=comm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include comm
in bn_kwards
.
I am very sorry for late review. |
.travis.yml
Outdated
conda env create -f environment.yml; | ||
source activate chainercv; | ||
cd $HOME; | ||
wget https://github.com/chainer/chainermn/archive/v1.0.0.tar.gz -O chainermn.tar.gz; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update to the latest release.
ChainerMN seems to be not installed correctly. It is raising an error |
Why do you install ChainerMN from source? Can't we install it by modifying |
Travis is failing because environment file is incorrect. |
Conda installation is still failing. |
You need The env file below worked.
|
Thanks. I updated it. |
Tests are failing when |
@yuyu2172 Sorry, I updated the test too. |
All tests passed. |
I checked the test log and it seems that ChainerMN is not installed properly. The log says that
As a consequence, the tests related to ChainerMN are skipped. |
I see. Thanks for catching it. I'll fix that. |
@yuyu2172 Fixed the |
63a1f02
to
96cd29a
Compare
96cd29a
to
a9e908d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
#388 became a too large PR, then I split it into some small PRs.
First,
Conv2DActiv
andConv2DBNActive
should be able to takedilate
option to useDilatedConvolution2D
instead ofConvolution2D
.Next,
Conv2DBNActive
should be able to takechainermn.links.MultiNodeBatchNormalization
to use batch normalization layers correctly with multiple GPUs.This PR introduces these two features.