Revert "[TFLite] Allows failing when model isn't generated (#21621)" (#21701)

This reverts commit 8c634ce4b0.
This commit is contained in:
Ilya Lavrenov 2023-12-15 18:15:52 +04:00 committed by GitHub
parent 993d503a28
commit 4b66fbfe21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 11 deletions

View File

@ -9,7 +9,6 @@ import sys
import urllib.request
import zipfile
src_url = "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/latest/pose_landmarker_lite.task"
path_to_model_dir = os.path.join(sys.argv[1], "downloads")
tflite_file_name = 'pose_detector.tflite'
tflite_model_path = os.path.join(path_to_model_dir, tflite_file_name)
@ -19,11 +18,7 @@ if not os.path.exists(path_to_model_dir):
os.makedirs(path_to_model_dir, exist_ok=True)
if not os.path.exists(tflite_model_path):
if not os.path.exists(task_file_path):
try:
urllib.request.urlretrieve(src_url, task_file_path)
except:
print(f"ERROR: Cannot download model archive, try to download it manually from {src_url} and place to {task_file_path}")
exit(2)
urllib.request.urlretrieve("https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/latest/pose_landmarker_lite.task", task_file_path)
with zipfile.ZipFile(task_file_path, "r") as f:
f.extract(tflite_file_name, path_to_model_dir)

View File

@ -14,11 +14,7 @@ out_folder = sys.argv[2]
mark_file = sys.argv[3]
assert gen_script.endswith('.py'), "Unexpected script: " + gen_script
try:
subprocess.run([sys.executable, gen_script, out_folder], env=os.environ, check=True)
except subprocess.CalledProcessError as cpe:
if cpe.returncode == 2:
exit(2)
subprocess.run([sys.executable, gen_script, out_folder], env=os.environ)
# Create mark file indicating that script was executed
with open(mark_file, "w") as fp: