From 5f2b9fd7651e6049769a24be58c61b1d51f1e1eb Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Tue, 24 Oct 2023 13:39:00 -0700 Subject: [PATCH] Speed up Python build by only building binary graph PiperOrigin-RevId: 576260883 --- setup.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index b5b75b73c..aa6004b7e 100644 --- a/setup.py +++ b/setup.py @@ -272,13 +272,14 @@ class BuildModules(build_ext.build_ext): self._download_external_file(external_file) binary_graphs = [ - 'face_detection/face_detection_short_range_cpu', - 'face_detection/face_detection_full_range_cpu', - 'face_landmark/face_landmark_front_cpu', - 'hand_landmark/hand_landmark_tracking_cpu', - 'holistic_landmark/holistic_landmark_cpu', 'objectron/objectron_cpu', - 'pose_landmark/pose_landmark_cpu', - 'selfie_segmentation/selfie_segmentation_cpu' + 'face_detection/face_detection_short_range_cpu.binarypb', + 'face_detection/face_detection_full_range_cpu.binarypb', + 'face_landmark/face_landmark_front_cpu.binarypb', + 'hand_landmark/hand_landmark_tracking_cpu.binarypb', + 'holistic_landmark/holistic_landmark_cpu.binarypb', + 'objectron/objectron_cpu.binarypb', + 'pose_landmark/pose_landmark_cpu.binarypb', + 'selfie_segmentation/selfie_segmentation_cpu.binarypb' ] for elem in binary_graphs: binary_graph = os.path.join('mediapipe/modules/', elem) @@ -312,7 +313,7 @@ class BuildModules(build_ext.build_ext): bazel_command.append('--define=OPENCV=source') _invoke_shell_command(bazel_command) - _copy_to_build_lib_dir(self.build_lib, binary_graph_target + '.binarypb') + _copy_to_build_lib_dir(self.build_lib, binary_graph_target) class GenerateMetadataSchema(build_ext.build_ext):