Skip to content

Commit d2d2b11

Browse files
committed
Add option to export phi-3-mini model via buck2
as title Differential Revision: [D59500806](https://our.internmc.facebook.com/intern/diff/D59500806/) ghstack-source-id: 233088629 Pull Request resolved: #4189
1 parent a85cd36 commit d2d2b11

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

examples/models/phi-3-mini/export_model.py renamed to examples/models/phi-3-mini/export_phi-3-mini.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
get_symmetric_quantization_config,
2020
XNNPACKQuantizer,
2121
)
22-
from torch.export import export
2322

2423
from transformers import Phi3ForCausalLM
2524

@@ -48,8 +47,14 @@ def main() -> None:
4847
model(*example_inputs)
4948
model = convert_pt2e(model, fold_quantize=False)
5049
DuplicateDynamicQuantChainPass()(model)
51-
model = export(
52-
model, example_inputs, dynamic_shapes=dynamic_shape, strict=False
50+
# TODO(lunwenh): update it to use export once
51+
# https://github.com/pytorch/pytorch/issues/128394 is resolved.
52+
model = torch.export._trace._export(
53+
model,
54+
example_inputs,
55+
dynamic_shapes=dynamic_shape,
56+
strict=False,
57+
pre_dispatch=False,
5358
)
5459

5560
edge_config = get_xnnpack_edge_compile_config()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def define_common_targets():
2+
"""
3+
Defines targets that should be shared between fbcode and xplat.
4+
5+
The directory containing this targets.bzl file should also contain both
6+
TARGETS and BUCK files that call this function.
7+
"""
8+
pass

0 commit comments

Comments
 (0)