manupa-arm commented on a change in pull request #10565:
URL: https://github.com/apache/tvm/pull/10565#discussion_r825043659



##########
File path: python/tvm/relay/testing/tf.py
##########
@@ -216,32 +216,43 @@ def get_workload_official(model_url, model_sub_path):
     model_sub_path:
         Sub path in extracted tar for the ftozen protobuf file.
 
+    retries: int
+        The number of retries to attempt downloading and uncompressing
+        the model in the CI, due to possible network and CI node issues.
+
     Returns
     -------
     model_path: str
         Full path to saved model file
 
     """
-
-    model_tar_name = os.path.basename(model_url)
-    model_path = download_testdata(model_url, model_tar_name, module=["tf", 
"official"])
-    dir_path = os.path.dirname(model_path)
-
-    if model_path.endswith("tgz") or model_path.endswith("gz"):
-        import tarfile
-
-        tar = tarfile.open(model_path)
-        tar.extractall(path=dir_path)
-        tar.close()
-    elif model_path.endswith("zip"):
-        import zipfile
-
-        zip_object = zipfile.ZipFile(model_path)
-        zip_object.extractall(path=dir_path)
-        zip_object.close()
-    else:
-        raise RuntimeError("Could not decompress the file: " + model_path)
-    return os.path.join(dir_path, model_sub_path)
+    attempts = retries + 1
+    error = None
+    for current_attempt_idx in range(attempts):
+        try:
+            model_tar_name = os.path.basename(model_url)
+            model_path = download_testdata(model_url, model_tar_name, 
module=["tf", "official"])

Review comment:
       Well, now in the issue you reported the error happens in the extractall 
function, where it find the download to be corrupt.
   
   So this should cover both cases




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