Skip to content

Commit f005dd5

Browse files
yushangdifacebook-github-bot
authored andcommitted
Migrate to training IR in executorch tests (#5941)
Summary: Pull Request resolved: #5941 Pull Request resolved: #5875 as title also bump pytorch pin clone of D63845664, this time does not export to a fork Reviewed By: mergennachin, tugsbayasgalan Differential Revision: D63994058 fbshipit-source-id: 9a616770607ea73c71465d2728406b35151f81f0
1 parent 9c4032b commit f005dd5

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

.ci/docker/ci_commit_pins/pytorch.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4b2970f7cd3cdd56883cacf116a8693862f89db5
1+
d1b87e26e5c4343f5b56bb1e6f89b479b389bfac

examples/apple/mps/scripts/mps_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def get_model_config(args):
166166

167167
# pre-autograd export. eventually this will become torch.export
168168
with torch.no_grad():
169-
model = torch._export.capture_pre_autograd_graph(model, example_inputs)
169+
model = torch.export.export_for_training(model, example_inputs).module()
170170
edge: EdgeProgramManager = export_to_edge(
171171
model,
172172
example_inputs,

examples/models/phi-3-mini/export_phi-3-mini.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
1616
from executorch.backends.xnnpack.utils.configs import get_xnnpack_edge_compile_config
1717
from executorch.exir import to_edge
18-
from torch._export import capture_pre_autograd_graph
1918
from torch.ao.quantization.quantize_pt2e import convert_pt2e, prepare_pt2e
2019

2120
from torch.ao.quantization.quantizer.xnnpack_quantizer import (
2221
get_symmetric_quantization_config,
2322
XNNPACKQuantizer,
2423
)
24+
from torch.export import export_for_training
2525

2626
from transformers import Phi3ForCausalLM
2727

@@ -64,9 +64,9 @@ def export(args) -> None:
6464
xnnpack_quantizer = XNNPACKQuantizer()
6565
xnnpack_quantizer.set_global(xnnpack_quant_config)
6666

67-
model = capture_pre_autograd_graph(
67+
model = export_for_training(
6868
model, example_inputs, dynamic_shapes=dynamic_shapes
69-
)
69+
).module()
7070
model = prepare_pt2e(model, xnnpack_quantizer) # pyre-fixme[6]
7171
model(*example_inputs)
7272
model = convert_pt2e(model)

exir/tests/test_passes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1413,10 +1413,10 @@ def quantize_model(
14131413
m_eager: torch.nn.Module, example_inputs: Tuple[torch.Tensor]
14141414
) -> Tuple[EdgeProgramManager, int, int]:
14151415
# program capture
1416-
m = torch._export.capture_pre_autograd_graph(
1416+
m = torch.export.export_for_training(
14171417
m_eager,
14181418
example_inputs,
1419-
)
1419+
).module()
14201420

14211421
quantizer = XNNPACKQuantizer()
14221422
quantization_config = get_symmetric_quantization_config()

install_requirements.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def python_is_compatible():
9494
# NOTE: If a newly-fetched version of the executorch repo changes the value of
9595
# NIGHTLY_VERSION, you should re-run this script to install the necessary
9696
# package versions.
97-
NIGHTLY_VERSION = "dev20241002"
97+
NIGHTLY_VERSION = "dev20241007"
9898

9999
# The pip repository that hosts nightly torch packages.
100100
TORCH_NIGHTLY_URL = "https://download.pytorch.org/whl/nightly/cpu"

0 commit comments

Comments
 (0)