Share persistent values among processes#486
Conversation
so that BatchNormalization etc can be safely shared among processes
|
I confirmed that this enabled training with batch normalization and actor-learner parallelism, so I removed [WIP]. |
chainerrl/misc/namedpersistent.py
Outdated
| for idx, link in enumerate(link._children): | ||
| prefix = '/{}'.format(idx) | ||
| for path, persistent in namedpersistent(link): | ||
| yield prefix + path, persistent |
There was a problem hiding this comment.
def _namedchildren(link):
...
elif isinstance(link, chainer.ChainList):
for idx, child in enumerate(link._children):
yield str(idx), childcould avoid repeating the recursion logic.
There was a problem hiding this comment.
I'm not sure how. Can you give me some more detail? chainer/chainer#6788 is also implemented with recursion, and I don't think we need to deviate from it.
There was a problem hiding this comment.
Probably I meant that a mutual recursion between namedpersistent and _namedchildren looks cleaner. It can be a matter of taste. Sorry that my previous comment is not readable (to me neither at first sight).
There was a problem hiding this comment.
Understood, thanks! I modified accordingly, so can you check again?
Co-Authored-By: Toshiki Kataoka <tos.lunar@gmail.com>
|
/test |
|
Successfully created a job for commit 4aaf766: |
|
/test |
|
Successfully created a job for commit b82b710: |
so that BatchNormalization etc can be safely shared among processes. This is required by #477
I'll remove [WIP] once I confirm that this enables training with batch normalization.
chainerrl.misc.namedpersistent, a function that mimics Addnamedpersistentchainer#6788chainerrl.misc.async_.extract_params_as_shared_arraysandchainerrl.misc.async_.set_shared_paramsso that not only parameters but also persistent values are shared among processes.