huajsj commented on a change in pull request #9108:
URL: https://github.com/apache/tvm/pull/9108#discussion_r721912249



##########
File path: python/tvm/contrib/pipeline_executor.py
##########
@@ -501,17 +538,18 @@ class PipelineExecutorFactoryModule(object):
 
     """
 
-    def __init__(self, pipeline_mods, mods_config):
-        mods, config = self.graph_executor_create(pipeline_mods, mods_config)
-        assert (
-            pipeline_executor_enabled()
-        ), "Pipeline executor is not enabled. Please \
-              re-build TVM with USE_PIPELINE_EXECUTOR=ON"
-        pipeline_create = tvm._ffi.get_global_func(
+    def __init__(self, pipeline_libs=None, mods_config=None):
+        self.pipeline_libs = pipeline_libs
+        self.mods_config = mods_config
+        self.pipeline_create = tvm._ffi.get_global_func(
             "tvm.pipeline_executor.create", allow_missing=False
         )
-        assert pipeline_create
-        self.module = pipeline_create(mods, config)
+        self.module = None
+        # Only create pipeline executor when pipeline_libs, mods_config and
+        # self.pipeline_create are not None.
+        if pipeline_libs and mods_config:
+            graph_executors, config = 
self.graph_executor_create(pipeline_libs, mods_config)
+            self.module = self.pipeline_create(graph_executors, config)

Review comment:
       PipelineExecutorFactoryModule have initialization methods, first is to 
initialize PipelineExecutorFactoryModule with valid `pipeline_libs`, 
`mods_config`, second method is to initialize PipelineExecutorFactoryModule 
with 0 parameter then call import_from_library to initialize the class.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to