mediapipe-nightly 0.10.10.post20240222__cp310-cp310-macosx_11_0_x86_64.whl → 0.10.11.post20240229__cp310-cp310-macosx_11_0_x86_64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. mediapipe/__init__.py +1 -1
  2. mediapipe/python/__init__.py +1 -0
  3. mediapipe/python/_framework_bindings.cpython-310-darwin.so +0 -0
  4. mediapipe/python/solution_base.py +10 -1
  5. mediapipe/tasks/cc/genai/__init__.py +0 -0
  6. mediapipe/tasks/cc/genai/inference/__init__.py +0 -0
  7. mediapipe/tasks/cc/genai/inference/c/__init__.py +0 -0
  8. mediapipe/tasks/cc/genai/inference/proto/__init__.py +0 -0
  9. mediapipe/tasks/cc/genai/inference/proto/llm_params_pb2.py +30 -0
  10. mediapipe/tasks/cc/genai/inference/proto/transformer_params_pb2.py +41 -0
  11. mediapipe/tasks/cc/genai/inference/utils/__init__.py +0 -0
  12. mediapipe/tasks/cc/genai/inference/utils/llm_utils/__init__.py +0 -0
  13. mediapipe/tasks/cc/genai/inference/utils/xnn_utils/__init__.py +0 -0
  14. mediapipe/tasks/cc/metadata/python/_pywrap_metadata_version.cpython-310-darwin.so +0 -0
  15. mediapipe/tasks/metadata/schema_py_generated.py +4019 -119
  16. mediapipe/tasks/python/genai/converter/llm_converter.py +2 -2
  17. mediapipe/tasks/python/metadata/flatbuffers_lib/_pywrap_flatbuffers.cpython-310-darwin.so +0 -0
  18. mediapipe/tasks/python/vision/__init__.py +5 -0
  19. {mediapipe_nightly-0.10.10.post20240222.dist-info → mediapipe_nightly-0.10.11.post20240229.dist-info}/METADATA +3 -1
  20. {mediapipe_nightly-0.10.10.post20240222.dist-info → mediapipe_nightly-0.10.11.post20240229.dist-info}/RECORD +23 -14
  21. {mediapipe_nightly-0.10.10.post20240222.dist-info → mediapipe_nightly-0.10.11.post20240229.dist-info}/LICENSE +0 -0
  22. {mediapipe_nightly-0.10.10.post20240222.dist-info → mediapipe_nightly-0.10.11.post20240229.dist-info}/WHEEL +0 -0
  23. {mediapipe_nightly-0.10.10.post20240222.dist-info → mediapipe_nightly-0.10.11.post20240229.dist-info}/top_level.txt +0 -0
mediapipe/__init__.py CHANGED
@@ -23,4 +23,4 @@ del modules
23
23
  del python
24
24
  del mediapipe
25
25
  del util
26
- __version__ = '0.10.10-20240222'
26
+ __version__ = '0.10.11-20240229'
@@ -14,6 +14,7 @@
14
14
 
15
15
  """MediaPipe Python API."""
16
16
 
17
+ from mediapipe.python._framework_bindings import model_ckpt_util
17
18
  from mediapipe.python._framework_bindings import resource_util
18
19
  from mediapipe.python._framework_bindings.calculator_graph import CalculatorGraph
19
20
  from mediapipe.python._framework_bindings.calculator_graph import GraphInputStreamAddMode
@@ -298,9 +298,12 @@ class SolutionBase:
298
298
  self._graph_outputs.clear()
299
299
 
300
300
  if isinstance(input_data, np.ndarray):
301
+ if self._input_stream_type_info is None:
302
+ raise ValueError('_input_stream_type_info is None in SolutionBase')
301
303
  if len(self._input_stream_type_info.keys()) != 1:
302
304
  raise ValueError(
303
- "Can't process single image input since the graph has more than one input streams."
305
+ "Can't process single image input since the graph has more than one"
306
+ ' input streams.'
304
307
  )
305
308
  input_dict = {next(iter(self._input_stream_type_info)): input_data}
306
309
  else:
@@ -309,6 +312,8 @@ class SolutionBase:
309
312
  # Set the timestamp increment to 33333 us to simulate the 30 fps video
310
313
  # input.
311
314
  self._simulated_timestamp += 33333
315
+ if self._graph is None:
316
+ raise ValueError('_graph is None in SolutionBase')
312
317
  for stream_name, data in input_dict.items():
313
318
  input_stream_type = self._input_stream_type_info[stream_name]
314
319
  if (input_stream_type == PacketDataType.PROTO_LIST or
@@ -335,6 +340,8 @@ class SolutionBase:
335
340
  self._graph.wait_until_idle()
336
341
  # Create a NamedTuple object where the field names are mapping to the graph
337
342
  # output stream names.
343
+ if self._output_stream_type_info is None:
344
+ raise ValueError('_output_stream_type_info is None in SolutionBase')
338
345
  solution_outputs = collections.namedtuple(
339
346
  'SolutionOutputs', self._output_stream_type_info.keys())
340
347
  for stream_name in self._output_stream_type_info.keys():
@@ -350,6 +357,8 @@ class SolutionBase:
350
357
 
351
358
  def close(self) -> None:
352
359
  """Closes all the input sources and the graph."""
360
+ if self._graph is None:
361
+ raise ValueError('Closing SolutionBase._graph which is already None')
353
362
  self._graph.close()
354
363
  self._graph = None
355
364
  self._input_stream_type_info = None
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,30 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: mediapipe/tasks/cc/genai/inference/proto/llm_params.proto
4
+ # Protobuf Python Version: 4.25.1
5
+ """Generated protocol buffer code."""
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import symbol_database as _symbol_database
9
+ from google.protobuf.internal import builder as _builder
10
+ # @@protoc_insertion_point(imports)
11
+
12
+ _sym_db = _symbol_database.Default()
13
+
14
+
15
+ from mediapipe.tasks.cc.genai.inference.proto import transformer_params_pb2 as mediapipe_dot_tasks_dot_cc_dot_genai_dot_inference_dot_proto_dot_transformer__params__pb2
16
+
17
+
18
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n9mediapipe/tasks/cc/genai/inference/proto/llm_params.proto\x12\x10odml.infra.proto\x1a\x41mediapipe/tasks/cc/genai/inference/proto/transformer_params.proto\"\x9f\x01\n\rLlmParameters\x12G\n\x16transformer_parameters\x18\x01 \x01(\x0b\x32\'.odml.infra.proto.TransformerParameters\x12\x12\n\nvocab_size\x18\x02 \x01(\x05\x12\x16\n\x0estart_token_id\x18\x04 \x01(\x05\x12\x13\n\x0bstop_tokens\x18\x05 \x03(\tJ\x04\x08\x03\x10\x04*\xd1\x01\n\x0cLlmModelType\x12\x1a\n\x16LLM_MODEL_TYPE_UNKNOWN\x10\x00\x12\x1f\n\x1bLLM_MODEL_TYPE_FALCON_RW_1B\x10\x05\x12\x1b\n\x17LLM_MODEL_TYPE_GEMMA_2B\x10\x06\x12#\n\x1fLLM_MODEL_TYPE_STABLELM_4E1T_3B\x10\x08\x12\x18\n\x14LLM_MODEL_TYPE_PHI_2\x10\x0b\"\x04\x08\x01\x10\x01\"\x04\x08\x02\x10\x02\"\x04\x08\x03\x10\x03\"\x04\x08\x04\x10\x04\"\x04\x08\x07\x10\x07\"\x04\x08\t\x10\t\"\x04\x08\n\x10\nB1\n\x1b\x63om.google.odml.infra.protoB\x12LLMParametersProtob\x06proto3')
19
+
20
+ _globals = globals()
21
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
22
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'mediapipe.tasks.cc.genai.inference.proto.llm_params_pb2', _globals)
23
+ if _descriptor._USE_C_DESCRIPTORS == False:
24
+ _globals['DESCRIPTOR']._options = None
25
+ _globals['DESCRIPTOR']._serialized_options = b'\n\033com.google.odml.infra.protoB\022LLMParametersProto'
26
+ _globals['_LLMMODELTYPE']._serialized_start=309
27
+ _globals['_LLMMODELTYPE']._serialized_end=518
28
+ _globals['_LLMPARAMETERS']._serialized_start=147
29
+ _globals['_LLMPARAMETERS']._serialized_end=306
30
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,41 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: mediapipe/tasks/cc/genai/inference/proto/transformer_params.proto
4
+ # Protobuf Python Version: 4.25.1
5
+ """Generated protocol buffer code."""
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import symbol_database as _symbol_database
9
+ from google.protobuf.internal import builder as _builder
10
+ # @@protoc_insertion_point(imports)
11
+
12
+ _sym_db = _symbol_database.Default()
13
+
14
+
15
+
16
+
17
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\nAmediapipe/tasks/cc/genai/inference/proto/transformer_params.proto\x12\x10odml.infra.proto\"\x9d\r\n\x15TransformerParameters\x12\x12\n\nbatch_size\x18\x01 \x01(\x05\x12\x16\n\x0emax_seq_length\x18\x02 \x01(\x05\x12\x15\n\rembedding_dim\x18\x03 \x01(\x05\x12\x18\n\x10hidden_dimension\x18\x04 \x01(\x05\x12\x16\n\x0ehead_dimension\x18\x05 \x01(\x05\x12\x11\n\tnum_heads\x18\x06 \x01(\x05\x12\x12\n\nnum_stacks\x18\x07 \x01(\x05\x12\x14\n\x0cnum_kv_heads\x18\t \x01(\x05\x12^\n\x17\x66\x65\x65\x64_forward_parameters\x18\x0b \x01(\x0b\x32=.odml.infra.proto.TransformerParameters.FeedForwardParameters\x12`\n\x18\x66inal_project_parameters\x18\x0c \x01(\x0b\x32>.odml.infra.proto.TransformerParameters.FinalProjectParameters\x12>\n\x08pre_norm\x18\r \x01(\x0e\x32,.odml.infra.proto.TransformerParameters.Norm\x12?\n\tpost_norm\x18\x0e \x01(\x0e\x32,.odml.infra.proto.TransformerParameters.Norm\x12@\n\nfinal_norm\x18\x0f \x01(\x0e\x32,.odml.infra.proto.TransformerParameters.Norm\x12\x62\n\x19self_attention_parameters\x18\x10 \x01(\x0b\x32?.odml.infra.proto.TransformerParameters.SelfAttentionParameters\x12+\n#skip_absolute_positional_embeddings\x18\x12 \x01(\x08\x1a\xf1\x01\n\x15\x46\x65\x65\x64\x46orwardParameters\x12\x0f\n\x07no_bias\x18\x01 \x01(\x08\x12\x46\n\nactivation\x18\x02 \x01(\x0e\x32\x32.odml.infra.proto.TransformerParameters.Activation\x12>\n\x08pre_norm\x18\x03 \x01(\x0e\x32,.odml.infra.proto.TransformerParameters.Norm\x12?\n\tpost_norm\x18\x04 \x01(\x0e\x32,.odml.infra.proto.TransformerParameters.Norm\x1a\x41\n\x16\x46inalProjectParameters\x12\x0f\n\x07no_bias\x18\x01 \x01(\x08\x12\x16\n\x0esoft_cap_value\x18\x02 \x01(\x02\x1a\xb1\x02\n\x17SelfAttentionParameters\x12\x13\n\x0bqkv_no_bias\x18\x01 \x01(\x08\x12\x19\n\x11post_proj_no_bias\x18\x02 \x01(\x08\x12V\n\x13\x61ttention_mask_type\x18\x03 \x01(\x0e\x32\x39.odml.infra.proto.TransformerParameters.AttentionMaskType\x12\x16\n\x0esoft_cap_value\x18\x04 \x01(\x02\x12]\n\x14\x61ttention_scale_type\x18\x05 \x01(\x0e\x32:.odml.infra.proto.TransformerParameters.AttentionScaleTypeH\x00\x88\x01\x01\x42\x17\n\x15_attention_scale_type\"<\n\x11\x41ttentionMaskType\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\n\n\x06\x43\x41USAL\x10\x01\x12\n\n\x06PREFIX\x10\x02\"F\n\nActivation\x12\x1a\n\x16\x41\x43TIVATION_UNSPECIFIED\x10\x00\x12\x08\n\x04GELU\x10\x01\x12\x08\n\x04SILU\x10\x02\x12\x08\n\x04RELU\x10\x03\"G\n\x04Norm\x12\x14\n\x10NORM_UNSPECIFIED\x10\x00\x12\x0b\n\x07NO_NORM\x10\x01\x12\x0c\n\x08RMS_NORM\x10\x02\x12\x0e\n\nLAYER_NORM\x10\x03\"p\n\x12\x41ttentionScaleType\x12\x1a\n\x16SCALE_TYPE_UNSPECIFIED\x10\x00\x12\x1c\n\x18SCALE_TYPE_PER_DIM_SCALE\x10\x01\x12 \n\x1cSCALE_TYPE_INV_SQRT_HEAD_DIM\x10\x02J\x04\x08\x08\x10\tJ\x04\x08\n\x10\x0bJ\x04\x08\x11\x10\x12\x42\x39\n\x1b\x63om.google.odml.infra.protoB\x1aTransformerParametersProtob\x06proto3')
18
+
19
+ _globals = globals()
20
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
21
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'mediapipe.tasks.cc.genai.inference.proto.transformer_params_pb2', _globals)
22
+ if _descriptor._USE_C_DESCRIPTORS == False:
23
+ _globals['DESCRIPTOR']._options = None
24
+ _globals['DESCRIPTOR']._serialized_options = b'\n\033com.google.odml.infra.protoB\032TransformerParametersProto'
25
+ _globals['_TRANSFORMERPARAMETERS']._serialized_start=88
26
+ _globals['_TRANSFORMERPARAMETERS']._serialized_end=1781
27
+ _globals['_TRANSFORMERPARAMETERS_FEEDFORWARDPARAMETERS']._serialized_start=826
28
+ _globals['_TRANSFORMERPARAMETERS_FEEDFORWARDPARAMETERS']._serialized_end=1067
29
+ _globals['_TRANSFORMERPARAMETERS_FINALPROJECTPARAMETERS']._serialized_start=1069
30
+ _globals['_TRANSFORMERPARAMETERS_FINALPROJECTPARAMETERS']._serialized_end=1134
31
+ _globals['_TRANSFORMERPARAMETERS_SELFATTENTIONPARAMETERS']._serialized_start=1137
32
+ _globals['_TRANSFORMERPARAMETERS_SELFATTENTIONPARAMETERS']._serialized_end=1442
33
+ _globals['_TRANSFORMERPARAMETERS_ATTENTIONMASKTYPE']._serialized_start=1444
34
+ _globals['_TRANSFORMERPARAMETERS_ATTENTIONMASKTYPE']._serialized_end=1504
35
+ _globals['_TRANSFORMERPARAMETERS_ACTIVATION']._serialized_start=1506
36
+ _globals['_TRANSFORMERPARAMETERS_ACTIVATION']._serialized_end=1576
37
+ _globals['_TRANSFORMERPARAMETERS_NORM']._serialized_start=1578
38
+ _globals['_TRANSFORMERPARAMETERS_NORM']._serialized_end=1649
39
+ _globals['_TRANSFORMERPARAMETERS_ATTENTIONSCALETYPE']._serialized_start=1651
40
+ _globals['_TRANSFORMERPARAMETERS_ATTENTIONSCALETYPE']._serialized_end=1763
41
+ # @@protoc_insertion_point(module_scope)
File without changes