[tf.lite] Use in-process conversion when the new converter is used
Out-of-process conversion was a workaround for the legacy converter, which would generally crash the process when conversion failed. However, out-of-process conversion also adds a good deal of complexity, so avoid it when using the new conversion backend. PiperOrigin-RevId: 312142994 Change-Id: I7ddc83df99ccf24be6e15f46d6a116dce8321933
This commit is contained in:
parent
9282621aa9
commit
869920697b
@ -169,9 +169,10 @@ def toco_convert_protos(model_flags_str,
|
||||
RuntimeError: When conversion fails, an exception is raised with the error
|
||||
message embedded.
|
||||
"""
|
||||
# TODO(aselle): When toco does not use fatal errors for failure, we can
|
||||
# switch this on.
|
||||
if not _toco_from_proto_bin:
|
||||
# Historically, TOCO conversion failures would trigger a crash, so we would
|
||||
# attempt to run the converter out-of-process. The MLIR conversion pipeline
|
||||
# surfaces errors instead, and can be safely run in-process.
|
||||
if enable_mlir_converter or not _toco_from_proto_bin:
|
||||
try:
|
||||
model_str = wrap_toco.wrapped_toco_convert(model_flags_str,
|
||||
toco_flags_str, input_data_str,
|
||||
|
Loading…
Reference in New Issue
Block a user