From 71183b792042e699a201c2fae96a6cb34be8c5d8 Mon Sep 17 00:00:00 2001 From: Haibin Lin Date: Fri, 28 Dec 2018 15:47:44 -0800 Subject: [PATCH 1/2] Reorder module import orders for dist-kvstore --- python/mxnet/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/mxnet/__init__.py b/python/mxnet/__init__.py index e960829e691b..851aff253125 100644 --- a/python/mxnet/__init__.py +++ b/python/mxnet/__init__.py @@ -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 @@ -82,3 +81,7 @@ from . import gluon __version__ = base.__version__ + +# 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 From f1e6e61100f38e87646d67099977c89575a1189b Mon Sep 17 00:00:00 2001 From: Haibin Lin Date: Sat, 29 Dec 2018 13:09:58 -0800 Subject: [PATCH 2/2] more code comments --- python/mxnet/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python/mxnet/__init__.py b/python/mxnet/__init__.py index 851aff253125..374a3b50bbb5 100644 --- a/python/mxnet/__init__.py +++ b/python/mxnet/__init__.py @@ -82,6 +82,10 @@ __version__ = base.__version__ -# dist kvstore module which launches a separate process when role is set to "server". -# this should be done after other modules are initialized. +# Dist kvstore module which launches a separate process when role is set to "server". +# This should be done after other modules are initialized. +# Otherwise this may result in errors when unpickling custom LR scheduler/optimizers. +# For example, the LRScheduler in gluoncv 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. from . import kvstore_server