ai-edge-torch-nightly 0.3.0.dev20241105__py3-none-any.whl → 0.3.0.dev20241108__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.
- ai_edge_torch/fx_pass_base.py +1 -1
- ai_edge_torch/generative/layers/kv_cache.py +3 -0
- ai_edge_torch/odml_torch/_torch_future.py +14 -0
- ai_edge_torch/odml_torch/export.py +4 -4
- ai_edge_torch/version.py +1 -1
- {ai_edge_torch_nightly-0.3.0.dev20241105.dist-info → ai_edge_torch_nightly-0.3.0.dev20241108.dist-info}/METADATA +2 -2
- {ai_edge_torch_nightly-0.3.0.dev20241105.dist-info → ai_edge_torch_nightly-0.3.0.dev20241108.dist-info}/RECORD +10 -10
- {ai_edge_torch_nightly-0.3.0.dev20241105.dist-info → ai_edge_torch_nightly-0.3.0.dev20241108.dist-info}/LICENSE +0 -0
- {ai_edge_torch_nightly-0.3.0.dev20241105.dist-info → ai_edge_torch_nightly-0.3.0.dev20241108.dist-info}/WHEEL +0 -0
- {ai_edge_torch_nightly-0.3.0.dev20241105.dist-info → ai_edge_torch_nightly-0.3.0.dev20241108.dist-info}/top_level.txt +0 -0
ai_edge_torch/fx_pass_base.py
CHANGED
@@ -76,7 +76,7 @@ def run_passes(
|
|
76
76
|
range_constraints=exported_program.range_constraints,
|
77
77
|
module_call_graph=exported_program.module_call_graph,
|
78
78
|
example_inputs=exported_program.example_inputs,
|
79
|
-
|
79
|
+
verifiers=exported_program.verifiers,
|
80
80
|
constants=exported_program.constants,
|
81
81
|
)
|
82
82
|
return exported_program
|
@@ -161,6 +161,9 @@ def update(
|
|
161
161
|
Returns:
|
162
162
|
KVCacheEntry: The updated KVCache entry based on the passed inputs.
|
163
163
|
"""
|
164
|
+
# Don't enable HLFB for kv cache op for now, since it won't work with LLM
|
165
|
+
# inference engine. Remove this part once we ship a new LLM inference engine.
|
166
|
+
enable_hlfb=False
|
164
167
|
update_func = _update_kv_hlfb_impl if enable_hlfb else _update_kv_base_impl
|
165
168
|
return update_func(cache, input_pos, k_slice, v_slice)
|
166
169
|
|
@@ -59,3 +59,17 @@ def graph_module_flat_inputs(ep: torch.export.ExportedProgram, args, kwargs):
|
|
59
59
|
ordered_tensor_constants = tuple()
|
60
60
|
|
61
61
|
return (*param_buffer_values, *flat_args, *ordered_tensor_constants)
|
62
|
+
|
63
|
+
|
64
|
+
# TODO(b/331481564): Replace this with CanonicalizePass + run_decomposition
|
65
|
+
def safe_run_decompositions(exported_program, decomp_table=None):
|
66
|
+
for node in exported_program.graph.nodes:
|
67
|
+
if node.target == torch.ops.aten.view.default:
|
68
|
+
# Passes or torch.export may generate aten.view nodes not respecting the
|
69
|
+
# tensor memory format. Changes all the aten.view to torch.reshape
|
70
|
+
# for retracing. If the input memory format is already contiguous,
|
71
|
+
# retracing in run_decomposition below would decompose torch.reshape
|
72
|
+
# back to one aten.view.
|
73
|
+
node.target = lambda self, size: torch.reshape(self.contiguous(), size)
|
74
|
+
|
75
|
+
return exported_program.run_decompositions(decomp_table)
|
@@ -262,13 +262,13 @@ def exported_program_to_mlir(
|
|
262
262
|
exported_program: torch.export.ExportedProgram,
|
263
263
|
) -> MlirLowered:
|
264
264
|
"""Lower the exported program to MLIR."""
|
265
|
-
exported_program =
|
266
|
-
lowerings.decompositions()
|
265
|
+
exported_program = _torch_future.safe_run_decompositions(
|
266
|
+
exported_program, lowerings.decompositions()
|
267
267
|
)
|
268
268
|
|
269
269
|
_convert_i64_to_i32(exported_program)
|
270
|
-
exported_program =
|
271
|
-
lowerings.decompositions()
|
270
|
+
exported_program = _torch_future.safe_run_decompositions(
|
271
|
+
exported_program, lowerings.decompositions()
|
272
272
|
)
|
273
273
|
|
274
274
|
with export_utils.create_ir_context() as context, ir.Location.unknown():
|
ai_edge_torch/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ai-edge-torch-nightly
|
3
|
-
Version: 0.3.0.
|
3
|
+
Version: 0.3.0.dev20241108
|
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
|
@@ -29,7 +29,7 @@ Requires-Dist: safetensors
|
|
29
29
|
Requires-Dist: tabulate
|
30
30
|
Requires-Dist: torch>=2.4.0
|
31
31
|
Requires-Dist: torch-xla>=2.4.0
|
32
|
-
Requires-Dist: tf-nightly
|
32
|
+
Requires-Dist: tf-nightly>=2.19.0.dev20241001
|
33
33
|
Requires-Dist: ai-edge-litert-nightly
|
34
34
|
Requires-Dist: ai-edge-quantizer-nightly
|
35
35
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
ai_edge_torch/__init__.py,sha256=48qP37uHT90YPs4eIUQxCiWVwqGEX3idCUs6mQKvX1U,1168
|
2
2
|
ai_edge_torch/config.py,sha256=FMWeCH2b7HYILBvaI1iZNnYCO4WAhDOwBZBmIE-xrF0,909
|
3
3
|
ai_edge_torch/conftest.py,sha256=r0GTrhMRhlmOGrrkvumHN8hkmyug6WvF60vWq8wRIBI,758
|
4
|
-
ai_edge_torch/fx_pass_base.py,sha256=
|
4
|
+
ai_edge_torch/fx_pass_base.py,sha256=518ziQ0TUxqum2qZXqlD8qr65pHPh8ZNLnwFC6zvK3k,4253
|
5
5
|
ai_edge_torch/model.py,sha256=N-pNpTxzhaFGhWhnSGd70lBzb9VlEhTOq5mddU7bvvI,5542
|
6
|
-
ai_edge_torch/version.py,sha256=
|
6
|
+
ai_edge_torch/version.py,sha256=sBOl0mgVPJtokiP8qTbTtY0R_qIaF0KNiALh7P3AJEk,706
|
7
7
|
ai_edge_torch/_convert/__init__.py,sha256=hHLluseD2R0Hh4W6XZRIXY_dRQeYudjsrKGf6LZz65g,671
|
8
8
|
ai_edge_torch/_convert/conversion.py,sha256=HwzfRx_DX5TLtPqwEH1_NOm38_INvHzHl4_mX67KOdQ,5448
|
9
9
|
ai_edge_torch/_convert/conversion_utils.py,sha256=Sr8qXVcTwc-ZnZmK7yxVrIOOp1S_vNrwzC0zUvLTI2o,2160
|
@@ -109,7 +109,7 @@ ai_edge_torch/generative/layers/attention.py,sha256=Z0Y_G8IG0LmvLX2u9D8__Fkr22sz
|
|
109
109
|
ai_edge_torch/generative/layers/attention_utils.py,sha256=zBVwlBUTs-nStIKCZG0ks5ra7tsqc9ShfakFJKH5rds,7344
|
110
110
|
ai_edge_torch/generative/layers/builder.py,sha256=Z5LyzCEThgnYZeyViakaE3yJVzTGHtw13acHsAQR15U,5050
|
111
111
|
ai_edge_torch/generative/layers/feed_forward.py,sha256=hdICat-8gW7-vxDAevJQ8NQ-mynllPiqLdXQMF6JMnc,4189
|
112
|
-
ai_edge_torch/generative/layers/kv_cache.py,sha256=
|
112
|
+
ai_edge_torch/generative/layers/kv_cache.py,sha256=lbm-yJ1jGPtcgWS4C3FmSnB1IlxqDE7g0BLRh3PN4N4,6324
|
113
113
|
ai_edge_torch/generative/layers/model_config.py,sha256=DdsdhTP5tZAtyWim-qW2m8HDBsYbs7boqSDb83vwgmE,6998
|
114
114
|
ai_edge_torch/generative/layers/normalization.py,sha256=eKAGst9rPuyRFExMcQFJO7R3iHdCtlmjeF_lITjLhwE,6498
|
115
115
|
ai_edge_torch/generative/layers/rotary_position_embedding.py,sha256=CZqOoibLcHvUgrgaIIWAlmk3XgE2inzx340MN-npLoU,1347
|
@@ -155,9 +155,9 @@ ai_edge_torch/lowertools/test_utils.py,sha256=bPgc2iXX16KYtMNvmsRdKfrCY6UJmcfitf
|
|
155
155
|
ai_edge_torch/lowertools/torch_xla_utils.py,sha256=XGZE0vZG9WSQT-6dFmPlU8W89z8rfXPRGjuZeuhXCIw,9205
|
156
156
|
ai_edge_torch/lowertools/translate_recipe.py,sha256=ymkBpFqAUiupRWqrPOWiVphKcXR1K5vHK0RjgBFtxlE,5652
|
157
157
|
ai_edge_torch/odml_torch/__init__.py,sha256=S8jOzE9nLof-6es3XDiGJRN-9H_XTxsVm9dE7lD3RWo,812
|
158
|
-
ai_edge_torch/odml_torch/_torch_future.py,sha256=
|
158
|
+
ai_edge_torch/odml_torch/_torch_future.py,sha256=AJ0klpsbu2ZBTfiZlqSOoaYzBVITt40a1fYN8xKkEPw,3044
|
159
159
|
ai_edge_torch/odml_torch/_torch_library.py,sha256=Lw1gqL2HWNRspdTwNhIkYAHDyafHedHtkXyKKxn-Wss,805
|
160
|
-
ai_edge_torch/odml_torch/export.py,sha256=
|
160
|
+
ai_edge_torch/odml_torch/export.py,sha256=4xwrsDeOAgzoB9m7EeNsBj6dC5Ajtn5aKDRQkdHxa-o,11584
|
161
161
|
ai_edge_torch/odml_torch/export_utils.py,sha256=q84U69ZQ82hLXw-xncJ8IW-K71Xux-NWlzZTs7hdZWA,5127
|
162
162
|
ai_edge_torch/odml_torch/tf_integration.py,sha256=lTFJPPEijLPFmn6qq2jbpVTQOo0YaOTK36kK6rCiyIE,5956
|
163
163
|
ai_edge_torch/odml_torch/composite/__init__.py,sha256=71GM_gDZxJyo38ZSoYSwhZX3xKA9rknO93JS9kw9w_c,778
|
@@ -186,8 +186,8 @@ ai_edge_torch/quantize/quant_config.py,sha256=U0KisSW-uZkoMJcy-ZP9W57p3tsa594fr9
|
|
186
186
|
ai_edge_torch/testing/__init__.py,sha256=hHLluseD2R0Hh4W6XZRIXY_dRQeYudjsrKGf6LZz65g,671
|
187
187
|
ai_edge_torch/testing/model_coverage/__init__.py,sha256=5P8J6Zk5YYtDvTBucFvB9NGSRI7Gw_24WnrbhXgycEE,765
|
188
188
|
ai_edge_torch/testing/model_coverage/model_coverage.py,sha256=UPB448aMDUyC0HNYVqio2rcJPnDN0tBQMP08J6vPYew,4718
|
189
|
-
ai_edge_torch_nightly-0.3.0.
|
190
|
-
ai_edge_torch_nightly-0.3.0.
|
191
|
-
ai_edge_torch_nightly-0.3.0.
|
192
|
-
ai_edge_torch_nightly-0.3.0.
|
193
|
-
ai_edge_torch_nightly-0.3.0.
|
189
|
+
ai_edge_torch_nightly-0.3.0.dev20241108.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
190
|
+
ai_edge_torch_nightly-0.3.0.dev20241108.dist-info/METADATA,sha256=gp2VN_X4YPdK8axZYIhqafgiJhCwfiN_tOWT-yL3lW0,1897
|
191
|
+
ai_edge_torch_nightly-0.3.0.dev20241108.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
192
|
+
ai_edge_torch_nightly-0.3.0.dev20241108.dist-info/top_level.txt,sha256=5KXRaF2hwkApYxf7Y8y_tVb9aulGTlbOoNdbx1aKRkE,14
|
193
|
+
ai_edge_torch_nightly-0.3.0.dev20241108.dist-info/RECORD,,
|
File without changes
|
File without changes
|