Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion examples/mediatek/model_export_scripts/llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ def export_to_et_ir(
alloc_graph_input=False,
alloc_graph_output=False,
),
extract_constant_segment=True,
extract_delegate_segments=True,
)
)
Expand Down
2 changes: 1 addition & 1 deletion examples/portable/scripts/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def main() -> None:
*MODEL_NAME_TO_MODEL[args.model_name]
)

backend_config = ExecutorchBackendConfig(extract_constant_segment=True)
backend_config = ExecutorchBackendConfig()
if args.segment_alignment is not None:
backend_config.segment_alignment = int(args.segment_alignment, 16)
if (
Expand Down
2 changes: 1 addition & 1 deletion exir/_serialize/_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def serialize_pte_binary(
*,
mutable_data: Optional[List[Buffer]] = None,
extract_delegate_segments: bool = False,
extract_constant_segment: bool = False,
extract_constant_segment: bool = True,
segment_alignment: int = 128,
constant_tensor_alignment: Optional[int] = None,
delegate_alignment: Optional[int] = None,
Expand Down
15 changes: 4 additions & 11 deletions exir/_serialize/test/test_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ def constant_segment_with_tensor_alignment(
pte_data = bytes(
serialize_pte_binary(
program,
extract_constant_segment=True,
segment_alignment=SEGMENT_ALIGNMENT,
constant_tensor_alignment=constant_tensor_alignment,
)
Expand Down Expand Up @@ -427,16 +426,12 @@ def test_round_trip_large_buffer_sizes(self) -> None:

def test_round_trip_no_segments_and_no_header(self) -> None:
"""Tests that a Program serialized with extract_delegate_segments=True
or extract_constant_segment=True, when there are no segments, does not
contain an extended header, constant segment, or delegate segments. Confirm
that a Program remains the same after serializing and deserializing.
when there are no segments does not contain an extended header,
constant segment, or delegate segments. Confirm that a Program remains
the same after serializing and deserializing.
"""
program = get_test_program()
pte_data = bytes(
serialize_pte_binary(
program, extract_delegate_segments=True, extract_constant_segment=True
)
)
pte_data = bytes(serialize_pte_binary(program, extract_delegate_segments=True))
self.assertGreater(len(pte_data), 16)

# File magic should be present at the expected offset.
Expand Down Expand Up @@ -637,7 +632,6 @@ def test_constant_segment_tensor_alignment_non_power_of_2_fails(self) -> None:
with self.assertRaises(ValueError):
serialize_pte_binary(
program,
extract_constant_segment=True,
segment_alignment=SEGMENT_ALIGNMENT,
constant_tensor_alignment=constant_tensor_alignment,
)
Expand All @@ -662,7 +656,6 @@ def test_constant_segment_and_delegate_segment(self) -> None:
serialize_pte_binary(
program,
extract_delegate_segments=True,
extract_constant_segment=True,
segment_alignment=SEGMENT_ALIGNMENT,
constant_tensor_alignment=CONSTANT_TENSOR_ALIGNMENT,
)
Expand Down
1 change: 0 additions & 1 deletion extension/llm/export/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ def to_executorch(self) -> "LLMEdgeManager":
assert self.edge_manager, "Need to run export_to_edge() first"
self.export_program = self.edge_manager.to_executorch(
ExecutorchBackendConfig(
extract_constant_segment=True,
extract_delegate_segments=True,
passes=[
QuantFusionPass(),
Expand Down
Loading