jwfromm commented on a change in pull request #7823:
URL: https://github.com/apache/tvm/pull/7823#discussion_r614236493



##########
File path: python/tvm/driver/tvmc/runner.py
##########
@@ -337,135 +347,75 @@ def run_module(
     times : list of str
         execution times generated by the time evaluator
     """
-
-    with tempfile.TemporaryDirectory() as tmp_dir:
-        logger.debug("extracting module file %s", module_file)
-        t = tarfile.open(module_file)
-        t.extractall(tmp_dir)
-        graph = open(os.path.join(tmp_dir, "mod.json")).read()
-        params = bytearray(open(os.path.join(tmp_dir, "mod.params"), 
"rb").read())
-
-        if hostname:
-            # Remote RPC
-            if rpc_key:
-                logger.debug("running on remote RPC tracker with key %s", 
rpc_key)
-                session = request_remote(rpc_key, hostname, port, timeout=1000)
-            else:
-                logger.debug("running on remote RPC with no key")
-                session = rpc.connect(hostname, port)
-        else:
-            # Local
-            logger.debug("running a local session")
-            session = rpc.LocalSession()
-
-        session.upload(os.path.join(tmp_dir, "mod.so"))
-        lib = session.load_module("mod.so")
-
-        # TODO expand to other supported devices, as listed in tvm.rpc.client 
(@leandron)
-        logger.debug("device is %s", device)
-        if device == "gpu":
-            dev = session.gpu()
-        elif device == "cl":
-            dev = session.cl()
+    if not isinstance(tvmc_package, TVMCPackage):
+        raise TVMCException(
+            "This model doesn't seem to have been compiled yet. "
+            "Try calling tvmc.compile on the model before running it."
+        )
+
+    lib_path = tvmc_package.lib_path

Review comment:
       I don't understand what you are arguing we replace this with, would you 
want lib_path to be an argument to `compile`? I don't want users to have to 
keep track of files saved to disk by default since its not very pythonic.




-- 
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.

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


Reply via email to