ai-edge-torch-nightly 0.5.0.dev20250418__py3-none-any.whl → 0.5.0.dev20250420__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.
@@ -35,14 +35,12 @@ def _run_convert_passes(
35
35
  )
36
36
 
37
37
  passes = [
38
+ fx_passes.CastInputsBf16ToF32Pass(),
38
39
  fx_passes.BuildInterpolateCompositePass(),
39
- fx_passes.CanonicalizePass(),
40
40
  fx_passes.OptimizeLayoutTransposesPass(),
41
41
  fx_passes.CanonicalizePass(),
42
42
  fx_passes.BuildAtenCompositePass(),
43
43
  fx_passes.RemoveNonUserOutputsPass(),
44
- fx_passes.CastInputsBf16ToF32Pass(),
45
- fx_passes.CanonicalizePass(),
46
44
  ]
47
45
 
48
46
  # Debuginfo is not injected automatically by odml_torch. Only inject
@@ -23,8 +23,5 @@ def run_generative_passes(
23
23
  ) -> torch.export.ExportedProgram:
24
24
  return fx_infra.run_passes(
25
25
  exported_program,
26
- [
27
- RemoveSDPACompositeZeroMaskPass(),
28
- CanonicalizePass(),
29
- ],
26
+ [RemoveSDPACompositeZeroMaskPass()],
30
27
  )
@@ -264,6 +264,8 @@ def _convert_i64_to_i32(exported_program: torch.export.ExportedProgram):
264
264
  exported_program: The exported program to apply the pass.
265
265
  """
266
266
 
267
+ is_modified = False
268
+
267
269
  def in_i32(x: int):
268
270
  return -2147483648 <= x <= 2147483647
269
271
 
@@ -271,6 +273,7 @@ def _convert_i64_to_i32(exported_program: torch.export.ExportedProgram):
271
273
  return torch.ops.aten._to_copy.default(x, dtype=torch.int32)
272
274
 
273
275
  def rewrite_arange(node: torch.fx.Node):
276
+ nonlocal is_modified
274
277
  tensor_meta = node.meta.get("tensor_meta", None)
275
278
  if not tensor_meta:
276
279
  return
@@ -282,12 +285,14 @@ def _convert_i64_to_i32(exported_program: torch.export.ExportedProgram):
282
285
  return
283
286
  op = node.target
284
287
  node.target = lambda *args, **kwargs: to_int32(op(*args, **kwargs))
288
+ is_modified = True
285
289
 
286
290
  graph_module = exported_program.graph_module
287
291
  for node in graph_module.graph.nodes:
288
292
 
289
293
  if node.target == torch.ops.aten.arange.start_step:
290
294
  rewrite_arange(node)
295
+ return is_modified
291
296
 
292
297
 
293
298
  # TODO(b/331481564) Make this a ai_edge_torch FX pass.
@@ -351,9 +356,9 @@ def exported_program_to_mlir(
351
356
  exported_program,
352
357
  fx_infra.decomp.pre_lower_decomp(),
353
358
  )
354
- _convert_i64_to_i32(exported_program)
355
- # Run decompositions for retracing and cananicalization.
356
- exported_program = fx_infra.safe_run_decompositions(exported_program, {})
359
+ if _convert_i64_to_i32(exported_program):
360
+ # Run decompositions for retracing and cananicalization, if modified.
361
+ exported_program = fx_infra.safe_run_decompositions(exported_program, {})
357
362
 
358
363
  # Passes below mutate the exported program to a state not executable by torch.
359
364
  # Do not call run_decompositions after applying the passes.
ai_edge_torch/version.py CHANGED
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- __version__ = "0.5.0.dev20250418"
16
+ __version__ = "0.5.0.dev20250420"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ai-edge-torch-nightly
3
- Version: 0.5.0.dev20250418
3
+ Version: 0.5.0.dev20250420
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
@@ -2,9 +2,9 @@ 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=RijgVzFc62dFf_A0Pr5jwDo3wtofAoxUcfBieTnHvIw,706
5
+ ai_edge_torch/version.py,sha256=yXQZIt1y2LjGAGZs_dNNktRUPPQAI4FYJV4wZ1gLZWI,706
6
6
  ai_edge_torch/_convert/__init__.py,sha256=hHLluseD2R0Hh4W6XZRIXY_dRQeYudjsrKGf6LZz65g,671
7
- ai_edge_torch/_convert/conversion.py,sha256=GPDsXhfECjDzOut4vh_d9qWcyfpxobFMBTsC7MyJbM0,5557
7
+ ai_edge_torch/_convert/conversion.py,sha256=0gpwEjlTue5RttDerzM5SVOUnY8g16444yL2YIFBx-E,5485
8
8
  ai_edge_torch/_convert/conversion_utils.py,sha256=Sr8qXVcTwc-ZnZmK7yxVrIOOp1S_vNrwzC0zUvLTI2o,2160
9
9
  ai_edge_torch/_convert/converter.py,sha256=075F8LRewk_033Ebsnft7FJr3KgtIbtZ_-8udIPy6ho,9980
10
10
  ai_edge_torch/_convert/signature.py,sha256=-YKJdLk-eNEHfhdPCtcQVtZf915SoVePEFxKXPPf16c,2572
@@ -147,7 +147,7 @@ ai_edge_torch/generative/examples/tiny_llama/__init__.py,sha256=hHLluseD2R0Hh4W6
147
147
  ai_edge_torch/generative/examples/tiny_llama/convert_to_tflite.py,sha256=LPxg7mAJ_aAUIx6eE5bxixPA8Ep9Vul0CWJoNcrD5oE,1565
148
148
  ai_edge_torch/generative/examples/tiny_llama/tiny_llama.py,sha256=mhJ18rb9sxrYRzv1YSzhbNs97oUZck99avZDcUO2oV8,2800
149
149
  ai_edge_torch/generative/examples/tiny_llama/verify.py,sha256=LRu6PSw7Lqu6HGbv1tO2i0nUCqe-VkRgboA10VZ7KNg,2431
150
- ai_edge_torch/generative/fx_passes/__init__.py,sha256=4rFrppMRKlTwwZeX1ON_cdp4yUqoTOES161IZQkJF6c,1143
150
+ ai_edge_torch/generative/fx_passes/__init__.py,sha256=PFSMsA1vfBfrV9ssBCkYJNl8Hx_bLdWjN01iyjPM5jE,1094
151
151
  ai_edge_torch/generative/fx_passes/remove_sdpa_zero_mask_pass.py,sha256=myGjal5A8yIBoqgArd2k40rZmCgD1Ya369KR7182bhI,2129
152
152
  ai_edge_torch/generative/layers/__init__.py,sha256=hHLluseD2R0Hh4W6XZRIXY_dRQeYudjsrKGf6LZz65g,671
153
153
  ai_edge_torch/generative/layers/attention.py,sha256=wLZ1jgUlcODBWgK3hnnhclHuuQDqYuGOZdYAI9EooOM,13247
@@ -212,7 +212,7 @@ ai_edge_torch/lowertools/translate_recipe.py,sha256=ymkBpFqAUiupRWqrPOWiVphKcXR1
212
212
  ai_edge_torch/odml_torch/__init__.py,sha256=S8jOzE9nLof-6es3XDiGJRN-9H_XTxsVm9dE7lD3RWo,812
213
213
  ai_edge_torch/odml_torch/_torch_future.py,sha256=jSYHf1CMTJzMizPMbu2b39hAt0ZTR6gQLq67GMe9KTo,2336
214
214
  ai_edge_torch/odml_torch/_torch_library.py,sha256=Lw1gqL2HWNRspdTwNhIkYAHDyafHedHtkXyKKxn-Wss,805
215
- ai_edge_torch/odml_torch/export.py,sha256=rxsyVagQgb-DDIVtwZwSTSVFINqwIZleOOfmPkBoPKg,14817
215
+ ai_edge_torch/odml_torch/export.py,sha256=lbLpdGa8MDE8oWNA7aSV3tOCQ9P9I2Ox95dSPEssn-g,14930
216
216
  ai_edge_torch/odml_torch/export_utils.py,sha256=QeA37Irlty6AiIBuqmHmJgn3lqahBQ5xsh6IKRoKm1g,4774
217
217
  ai_edge_torch/odml_torch/tf_integration.py,sha256=NN29WeXmHZ0S1RPDFHUnBi2DEjMvAtwczStPYIsQ1w8,4849
218
218
  ai_edge_torch/odml_torch/composite/__init__.py,sha256=71GM_gDZxJyo38ZSoYSwhZX3xKA9rknO93JS9kw9w_c,778
@@ -245,8 +245,8 @@ ai_edge_torch/testing/__init__.py,sha256=_yGgvnBZWb7T3IN3mc4x1sS4vM96HZwM8pwIcPG
245
245
  ai_edge_torch/testing/export.py,sha256=dguMa-aEi-WDPnmGBUs2IPdEmt2IVmHOELH19uiJ1uU,3014
246
246
  ai_edge_torch/testing/model_coverage/__init__.py,sha256=5P8J6Zk5YYtDvTBucFvB9NGSRI7Gw_24WnrbhXgycEE,765
247
247
  ai_edge_torch/testing/model_coverage/model_coverage.py,sha256=UPB448aMDUyC0HNYVqio2rcJPnDN0tBQMP08J6vPYew,4718
248
- ai_edge_torch_nightly-0.5.0.dev20250418.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
249
- ai_edge_torch_nightly-0.5.0.dev20250418.dist-info/METADATA,sha256=cmJPI-Zen5YAjRWQPoVwvcAwVZJGz3Jz0OuNAHs5498,2051
250
- ai_edge_torch_nightly-0.5.0.dev20250418.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
251
- ai_edge_torch_nightly-0.5.0.dev20250418.dist-info/top_level.txt,sha256=5KXRaF2hwkApYxf7Y8y_tVb9aulGTlbOoNdbx1aKRkE,14
252
- ai_edge_torch_nightly-0.5.0.dev20250418.dist-info/RECORD,,
248
+ ai_edge_torch_nightly-0.5.0.dev20250420.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
249
+ ai_edge_torch_nightly-0.5.0.dev20250420.dist-info/METADATA,sha256=dqTzx2gTDf6SkPglyObeZL_KZAlGzDITMcbP3qHKINk,2051
250
+ ai_edge_torch_nightly-0.5.0.dev20250420.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
251
+ ai_edge_torch_nightly-0.5.0.dev20250420.dist-info/top_level.txt,sha256=5KXRaF2hwkApYxf7Y8y_tVb9aulGTlbOoNdbx1aKRkE,14
252
+ ai_edge_torch_nightly-0.5.0.dev20250420.dist-info/RECORD,,