Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Reorder module import orders for dist-kvstore #13742

Merged
merged 2 commits into from
Dec 29, 2018
Merged
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion python/mxnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
from . import lr_scheduler
# use mx.kv as short for kvstore
from . import kvstore as kv
from . import kvstore_server
# Runtime compile module
from . import rtc
# Attribute scope to add attributes to symbolic graphs
Expand Down Expand Up @@ -82,3 +81,7 @@
from . import gluon

__version__ = base.__version__

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, tricky issue. Nice fix. I think add more details as code comment taking from your PR description will be useful.
Otherwise this may result in error when unpickling custom LR scheduler/optimizers. For example, the LRScheduler in gluoncv https://github.com/dmlc/gluon-cv/blob/master/gluoncv/utils/lr_scheduler.py#L8 depends on a specific version of MXNet, and checks the __version__ attr of MXNet, which is not set on kvstore server due to the fact that kvstore-server module is imported before the __version__ attr is set.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added. Thanks

# dist kvstore module which launches a separate process when role is set to "server".
# this should be done after other modules are initialized.
from . import kvstore_server