ai-edge-torch-nightly 0.4.0.dev20250406__py3-none-any.whl → 0.5.0.dev20250408__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -209,7 +209,10 @@ class MlirLowered:
209
209
 
210
210
  def get_text(self, enable_debug_info=False):
211
211
  return str(
212
- self.module.operation.get_asm(enable_debug_info=enable_debug_info)
212
+ self.module.operation.get_asm(
213
+ enable_debug_info=enable_debug_info,
214
+ large_elements_limit=16,
215
+ )
213
216
  )
214
217
 
215
218
  @property
@@ -326,8 +329,24 @@ def _convert_q_dq_per_channel_args_to_list(
326
329
 
327
330
  def exported_program_to_mlir(
328
331
  exported_program: torch.export.ExportedProgram,
332
+ *,
333
+ ir_context: ir.Context | None = None,
334
+ _pre_lower_pass: (
335
+ Callable[[torch.export.ExportedProgram], None] | None
336
+ ) = None,
329
337
  ) -> MlirLowered:
330
- """Lower the exported program to MLIR."""
338
+ """Lower the exported program to MLIR.
339
+
340
+ Args:
341
+ exported_program: The exported program to lower.
342
+ ir_context: The MLIR context to use. If not provided, a new context will be
343
+ created.
344
+ _pre_lower_pass: A function to run on exported program before lowering.
345
+
346
+ Returns:
347
+ The lowered MLIR module, metadata, and weight tensors bundle from exported
348
+ program.
349
+ """
331
350
  exported_program = fx_infra.safe_run_decompositions(
332
351
  exported_program,
333
352
  fx_infra.decomp.pre_lower_decomp(),
@@ -340,10 +359,16 @@ def exported_program_to_mlir(
340
359
  # Do not call run_decompositions after applying the passes.
341
360
  _convert_q_dq_per_channel_args_to_list(exported_program)
342
361
 
343
- with export_utils.create_ir_context() as context, ir.Location.unknown():
362
+ if _pre_lower_pass:
363
+ _pre_lower_pass(exported_program)
364
+
365
+ if not ir_context:
366
+ ir_context = export_utils.create_ir_context()
367
+
368
+ with ir_context, ir.Location.unknown():
344
369
 
345
370
  module = ir.Module.create()
346
- lctx = LoweringContext(context, module)
371
+ lctx = LoweringContext(ir_context, module)
347
372
  interpreter = LoweringInterpreter(exported_program.graph_module, lctx)
348
373
  ir_flat_inputs, export_flat_args, tensor_metas = _build_flat_inputs(
349
374
  exported_program
@@ -382,7 +407,6 @@ def exported_program_to_mlir(
382
407
 
383
408
  main_func.attributes["sym_visibility"] = ir.StringAttr.get("public")
384
409
  temp_func.erase()
385
-
386
410
  module.operation.verify()
387
411
 
388
412
  input_signature = []
@@ -422,5 +446,5 @@ def exported_program_to_mlir(
422
446
  for tensor_meta in _get_output_metas(exported_program)
423
447
  ]
424
448
  return MlirLowered(
425
- context, module, state_dict, input_signature, output_signature
449
+ ir_context, module, state_dict, input_signature, output_signature
426
450
  )
ai_edge_torch/version.py CHANGED
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- __version__ = "0.4.0.dev20250406"
16
+ __version__ = "0.5.0.dev20250408"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ai-edge-torch-nightly
3
- Version: 0.4.0.dev20250406
3
+ Version: 0.5.0.dev20250408
4
4
  Summary: Supporting PyTorch models with the Google AI Edge TFLite runtime.
5
5
  Home-page: https://github.com/google-ai-edge/ai-edge-torch
6
6
  Keywords: On-Device ML,AI,Google,TFLite,PyTorch,LLMs,GenAI
@@ -25,6 +25,7 @@ License-File: LICENSE
25
25
  Requires-Dist: numpy
26
26
  Requires-Dist: scipy
27
27
  Requires-Dist: safetensors
28
+ Requires-Dist: multipledispatchtransformerskagglehub
28
29
  Requires-Dist: tabulate
29
30
  Requires-Dist: torch>=2.4.0
30
31
  Requires-Dist: tf-nightly>=2.19.0.dev20250101
@@ -2,7 +2,7 @@ ai_edge_torch/__init__.py,sha256=8sPR_5uXJA4NEE0nIwNdSl-ADOJEoR8hAgYvBQDY70Y,120
2
2
  ai_edge_torch/_config.py,sha256=AiqhbcheF7j_ozIGDLC89k1we95aVgFDa-tR6h7UI0s,2529
3
3
  ai_edge_torch/conftest.py,sha256=r0GTrhMRhlmOGrrkvumHN8hkmyug6WvF60vWq8wRIBI,758
4
4
  ai_edge_torch/model.py,sha256=N-pNpTxzhaFGhWhnSGd70lBzb9VlEhTOq5mddU7bvvI,5542
5
- ai_edge_torch/version.py,sha256=JDO-IgMGe7pl0KjfHjYEa55njUvjLd-nMF0UWJ0_6AY,706
5
+ ai_edge_torch/version.py,sha256=Lf4c2aVfixNX2KTgdqQTLOGBdi0vVxNOkJuNt4SvQ8c,706
6
6
  ai_edge_torch/_convert/__init__.py,sha256=hHLluseD2R0Hh4W6XZRIXY_dRQeYudjsrKGf6LZz65g,671
7
7
  ai_edge_torch/_convert/conversion.py,sha256=gpXQnifODU-mWxkUZw_3ov1lEYBw1SPVIcqj5k7pTGo,5550
8
8
  ai_edge_torch/_convert/conversion_utils.py,sha256=Sr8qXVcTwc-ZnZmK7yxVrIOOp1S_vNrwzC0zUvLTI2o,2160
@@ -210,7 +210,7 @@ ai_edge_torch/lowertools/translate_recipe.py,sha256=ymkBpFqAUiupRWqrPOWiVphKcXR1
210
210
  ai_edge_torch/odml_torch/__init__.py,sha256=S8jOzE9nLof-6es3XDiGJRN-9H_XTxsVm9dE7lD3RWo,812
211
211
  ai_edge_torch/odml_torch/_torch_future.py,sha256=jSYHf1CMTJzMizPMbu2b39hAt0ZTR6gQLq67GMe9KTo,2336
212
212
  ai_edge_torch/odml_torch/_torch_library.py,sha256=Lw1gqL2HWNRspdTwNhIkYAHDyafHedHtkXyKKxn-Wss,805
213
- ai_edge_torch/odml_torch/export.py,sha256=7l8R0DEq_vfns8iWpruMlIyaIKZAFzoAy369-7iRrl0,14164
213
+ ai_edge_torch/odml_torch/export.py,sha256=rxsyVagQgb-DDIVtwZwSTSVFINqwIZleOOfmPkBoPKg,14817
214
214
  ai_edge_torch/odml_torch/export_utils.py,sha256=QeA37Irlty6AiIBuqmHmJgn3lqahBQ5xsh6IKRoKm1g,4774
215
215
  ai_edge_torch/odml_torch/tf_integration.py,sha256=NN29WeXmHZ0S1RPDFHUnBi2DEjMvAtwczStPYIsQ1w8,4849
216
216
  ai_edge_torch/odml_torch/composite/__init__.py,sha256=71GM_gDZxJyo38ZSoYSwhZX3xKA9rknO93JS9kw9w_c,778
@@ -243,8 +243,8 @@ ai_edge_torch/testing/__init__.py,sha256=_yGgvnBZWb7T3IN3mc4x1sS4vM96HZwM8pwIcPG
243
243
  ai_edge_torch/testing/export.py,sha256=dguMa-aEi-WDPnmGBUs2IPdEmt2IVmHOELH19uiJ1uU,3014
244
244
  ai_edge_torch/testing/model_coverage/__init__.py,sha256=5P8J6Zk5YYtDvTBucFvB9NGSRI7Gw_24WnrbhXgycEE,765
245
245
  ai_edge_torch/testing/model_coverage/model_coverage.py,sha256=UPB448aMDUyC0HNYVqio2rcJPnDN0tBQMP08J6vPYew,4718
246
- ai_edge_torch_nightly-0.4.0.dev20250406.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
247
- ai_edge_torch_nightly-0.4.0.dev20250406.dist-info/METADATA,sha256=ePIGy44ydD_RrrDoZipgy4rPG-K-xCkusBrXRBlVg3U,1966
248
- ai_edge_torch_nightly-0.4.0.dev20250406.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
249
- ai_edge_torch_nightly-0.4.0.dev20250406.dist-info/top_level.txt,sha256=5KXRaF2hwkApYxf7Y8y_tVb9aulGTlbOoNdbx1aKRkE,14
250
- ai_edge_torch_nightly-0.4.0.dev20250406.dist-info/RECORD,,
246
+ ai_edge_torch_nightly-0.5.0.dev20250408.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
247
+ ai_edge_torch_nightly-0.5.0.dev20250408.dist-info/METADATA,sha256=-Bw-LUn9l-B66aMZiFiUiYBifr1B6Fr86LU8KXtBieo,2019
248
+ ai_edge_torch_nightly-0.5.0.dev20250408.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
249
+ ai_edge_torch_nightly-0.5.0.dev20250408.dist-info/top_level.txt,sha256=5KXRaF2hwkApYxf7Y8y_tVb9aulGTlbOoNdbx1aKRkE,14
250
+ ai_edge_torch_nightly-0.5.0.dev20250408.dist-info/RECORD,,