Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the PyTorch passes to the tflite converter. #146

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ai_edge_torch/lowertools/odml_torch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import torch

from tensorflow.compiler.tf2xla.python import xla as tfxla
from tensorflow.lite.python import conversion_metadata_schema_py_generated as conversion_metadata_fb

MlirBundle = odml_torch.export.MlirLowered

Expand Down Expand Up @@ -162,7 +163,9 @@ def merged_bundle_to_tfl_model(
)

converter = tf.lite.TFLiteConverter.from_saved_model(temp_dir_path)
converter._set_original_model_type(conversion_metadata_fb.ModelType.PYTORCH)
converter._experimental_enable_composite_direct_lowering = True
converter.model_origin_framework = "PYTORCH"

conversion_utils.apply_tfl_converter_flags(converter, _tfl_converter_flags)

Expand Down
Loading