Speed up Python build by only building binary graph

PiperOrigin-RevId: 576260883
This commit is contained in:
Sebastian Schmidt 2023-10-24 13:39:00 -07:00 committed by Copybara-Service
parent c698414c71
commit 5f2b9fd765

View File

@ -272,13 +272,14 @@ class BuildModules(build_ext.build_ext):
self._download_external_file(external_file) self._download_external_file(external_file)
binary_graphs = [ binary_graphs = [
'face_detection/face_detection_short_range_cpu', 'face_detection/face_detection_short_range_cpu.binarypb',
'face_detection/face_detection_full_range_cpu', 'face_detection/face_detection_full_range_cpu.binarypb',
'face_landmark/face_landmark_front_cpu', 'face_landmark/face_landmark_front_cpu.binarypb',
'hand_landmark/hand_landmark_tracking_cpu', 'hand_landmark/hand_landmark_tracking_cpu.binarypb',
'holistic_landmark/holistic_landmark_cpu', 'objectron/objectron_cpu', 'holistic_landmark/holistic_landmark_cpu.binarypb',
'pose_landmark/pose_landmark_cpu', 'objectron/objectron_cpu.binarypb',
'selfie_segmentation/selfie_segmentation_cpu' 'pose_landmark/pose_landmark_cpu.binarypb',
'selfie_segmentation/selfie_segmentation_cpu.binarypb'
] ]
for elem in binary_graphs: for elem in binary_graphs:
binary_graph = os.path.join('mediapipe/modules/', elem) binary_graph = os.path.join('mediapipe/modules/', elem)
@ -312,7 +313,7 @@ class BuildModules(build_ext.build_ext):
bazel_command.append('--define=OPENCV=source') bazel_command.append('--define=OPENCV=source')
_invoke_shell_command(bazel_command) _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): class GenerateMetadataSchema(build_ext.build_ext):