Skip to content

Commit 097b919

Browse files
committed
Update base for Update on "Serializing from_node info in et serializer"
We need to use the from_node informaton in deserialzied exported graph for operator tracing in et.inspector. this diff updates the serizalier to support serde from_node info. Differential Revision: [D78293986](https://our.internmc.facebook.com/intern/diff/D78293986/) [ghstack-poisoned]
2 parents ffe73e2 + e44da93 commit 097b919

File tree

13 files changed

+653
-660
lines changed

13 files changed

+653
-660
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ab43fe4bdf5ccd82897f0e982c451a0127bd175e
1+
2dccff7dcf56b0d168ebfd7ca08bdeca37273c56

examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@
948948
isa = XCRemoteSwiftPackageReference;
949949
repositoryURL = "https://github.com/pytorch/executorch";
950950
requirement = {
951-
branch = "swiftpm-0.8.0.20250714";
951+
branch = "swiftpm-0.8.0.20250724";
952952
kind = branch;
953953
};
954954
};

examples/models/llama/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ LLAMA_CHECKPOINT=path/to/consolidated.00.pth
168168
LLAMA_PARAMS=path/to/params.json
169169
170170
python -m extension.llm.export.export_llm \
171-
--config examples/models/llamaconfig/llama_bf16.yaml
171+
--config examples/models/llamaconfig/llama_bf16.yaml \
172172
+base.model_class="llama3_2" \
173173
+base.checkpoint="${LLAMA_CHECKPOINT:?}" \
174174
+base.params="${LLAMA_PARAMS:?}" \
@@ -186,7 +186,7 @@ LLAMA_QUANTIZED_CHECKPOINT=path/to/spinquant/consolidated.00.pth.pth
186186
LLAMA_PARAMS=path/to/spinquant/params.json
187187
188188
python -m extension.llm.export.export_llm \
189-
--config examples/models/llama/config/llama_xnnpack_spinquant.yaml
189+
--config examples/models/llama/config/llama_xnnpack_spinquant.yaml \
190190
+base.model_class="llama3_2" \
191191
+base.checkpoint="${LLAMA_QUANTIZED_CHECKPOINT:?}" \
192192
+base.params="${LLAMA_PARAMS:?}"
@@ -203,7 +203,7 @@ LLAMA_QUANTIZED_CHECKPOINT=path/to/qlora/consolidated.00.pth.pth
203203
LLAMA_PARAMS=path/to/qlora/params.json
204204
205205
python -m extension.llm.export.export_llm \
206-
--config examples/models/llama/config/llama_xnnpack_qat.yaml
206+
--config examples/models/llama/config/llama_xnnpack_qat.yaml \
207207
+base.model_class="llama3_2" \
208208
+base.checkpoint="${LLAMA_QUANTIZED_CHECKPOINT:?}" \
209209
+base.params="${LLAMA_PARAMS:?}" \
@@ -219,15 +219,16 @@ You can export and run the original Llama 3 8B instruct model.
219219
2. Export model and generate `.pte` file
220220
```
221221
python -m extension.llm.export.export_llm \
222-
--config examples/models/llama/config/llama_q8da4w.yaml
223-
+base.model_clas="llama3"
222+
--config examples/models/llama/config/llama_q8da4w.yaml \
223+
+base.model_class="llama3" \
224224
+base.checkpoint=<consolidated.00.pth.pth> \
225225
+base.params=<params.json>
226226
```
227-
Due to the larger vocabulary size of Llama 3, we recommend quantizing the embeddings with `quantization.embedding_quantize=\'4,32\'` as shown above to further reduce the model size.
228227

228+
Due to the larger vocabulary size of Llama 3, we recommend quantizing the embeddings with `quantization.embedding_quantize=\'4,32\'` as shown above to further reduce the model size.
229229

230-
If you're interested in deploying on non-CPU backends, [please refer the non-cpu-backend section](non_cpu_backends.md)
230+
231+
If you're interested in deploying on non-CPU backends, [please refer the non-cpu-backend section](non_cpu_backends.md)
231232

232233
## Step 3: Run on your computer to validate
233234

@@ -450,7 +451,7 @@ python -m examples.models.llama.eval_llama \
450451
-d <checkpoint dtype> \
451452
--tasks mmlu \
452453
--num_fewshot 5 \
453-
--max_seq_len <max sequence length>
454+
--max_seq_len <max sequence length> \
454455
--max_context_len <max context length>
455456
```
456457

examples/models/llava/runner/llava_runner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class ET_EXPERIMENTAL LlavaRunner
6363
bool echo = true) override;
6464

6565
private:
66-
inline static const std::string kPresetPrompt =
66+
inline static const char* kPresetPrompt =
6767
"A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions. USER: ";
6868
};
6969

examples/openvino/aot_optimize_and_infer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def transform_fn(x):
278278
return x[0]
279279

280280
quantized_model = quantize_model(
281-
cast(torch.fx.GraphModule, aten_dialect.module()),
281+
cast(torch.fx.GraphModule, aten_dialect.module()), # type: ignore[redundant-cast]
282282
calibration_dataset,
283283
subset_size=subset_size,
284284
transform_fn=transform_fn,

extension/benchmark/apple/Benchmark/Benchmark.xcodeproj/project.pbxproj

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
0314AE3A2E2AAEE700DDE821 /* executorch_llm in Frameworks */ = {isa = PBXBuildFile; productRef = 0314AE392E2AAEE700DDE821 /* executorch_llm */; };
1011
032A73CA2CAFBA8600932D36 /* LLaMATests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 032A73C82CAFBA8600932D36 /* LLaMATests.mm */; };
1112
0351D9D72CAFC9A200607121 /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 03C7FA322C8AA24200E6E9AE /* Resources */; };
1213
03B0118E2CAC567900054791 /* DynamicTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B0118C2CAC567900054791 /* DynamicTestCase.m */; };
@@ -18,7 +19,6 @@
1819
03F181502D7262FC0058BDF9 /* backend_mps in Frameworks */ = {isa = PBXBuildFile; productRef = 03F1814F2D7262FC0058BDF9 /* backend_mps */; };
1920
03F181522D7262FC0058BDF9 /* backend_xnnpack in Frameworks */ = {isa = PBXBuildFile; productRef = 03F181512D7262FC0058BDF9 /* backend_xnnpack */; };
2021
03F181542D7262FC0058BDF9 /* executorch in Frameworks */ = {isa = PBXBuildFile; productRef = 03F181532D7262FC0058BDF9 /* executorch */; };
21-
0314AE3A2E2AAEE700DDE821 /* executorch_llm in Frameworks */ = {isa = PBXBuildFile; productRef = 0314AE392E2AAEE700DDE821 /* executorch_llm */; };
2222
03F181562D7262FC0058BDF9 /* kernels_llm in Frameworks */ = {isa = PBXBuildFile; productRef = 03F181552D7262FC0058BDF9 /* kernels_llm */; };
2323
03F181582D7262FC0058BDF9 /* kernels_optimized in Frameworks */ = {isa = PBXBuildFile; productRef = 03F181572D7262FC0058BDF9 /* kernels_optimized */; };
2424
03F1815C2D7262FC0058BDF9 /* kernels_quantized in Frameworks */ = {isa = PBXBuildFile; productRef = 03F1815B2D7262FC0058BDF9 /* kernels_quantized */; };
@@ -41,7 +41,6 @@
4141
03B0118C2CAC567900054791 /* DynamicTestCase.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DynamicTestCase.m; sourceTree = "<group>"; };
4242
03B0118F2CAD114E00054791 /* ResourceTestCase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ResourceTestCase.h; sourceTree = "<group>"; };
4343
03B011902CAD114E00054791 /* ResourceTestCase.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ResourceTestCase.m; sourceTree = "<group>"; };
44-
03B019502C8A80D30044D558 /* Tests.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Tests.xcconfig; sourceTree = "<group>"; };
4544
03B2D3642C8A515A0046936E /* Benchmark.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Benchmark.app; sourceTree = BUILT_PRODUCTS_DIR; };
4645
03B2D3672C8A515A0046936E /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
4746
03B2D36D2C8A515B0046936E /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = "<group>"; };
@@ -131,7 +130,6 @@
131130
032A73C92CAFBA8600932D36 /* LLaMA */,
132131
03E7E6782CBDC1C900205E71 /* CoreMLTests.mm */,
133132
03B2D3792C8A515C0046936E /* GenericTests.mm */,
134-
03B019502C8A80D30044D558 /* Tests.xcconfig */,
135133
037C96A02C8A570B00B3DF38 /* Tests.xctestplan */,
136134
);
137135
path = Tests;
@@ -438,7 +436,6 @@
438436
};
439437
03B2D38D2C8A515C0046936E /* Debug */ = {
440438
isa = XCBuildConfiguration;
441-
baseConfigurationReference = 03B019502C8A80D30044D558 /* Tests.xcconfig */;
442439
buildSettings = {
443440
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
444441
BUNDLE_LOADER = "$(TEST_HOST)";
@@ -450,6 +447,7 @@
450447
MACOSX_DEPLOYMENT_TARGET = 12.0;
451448
MARKETING_VERSION = 1.0;
452449
OTHER_CODE_SIGN_FLAGS = "--deep";
450+
OTHER_LDFLAGS = "-all_load";
453451
PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.BenchmarkTests;
454452
PRODUCT_NAME = "$(TARGET_NAME)";
455453
REGISTER_APP_GROUPS = NO;
@@ -465,7 +463,6 @@
465463
};
466464
03B2D38E2C8A515C0046936E /* Release */ = {
467465
isa = XCBuildConfiguration;
468-
baseConfigurationReference = 03B019502C8A80D30044D558 /* Tests.xcconfig */;
469466
buildSettings = {
470467
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
471468
BUNDLE_LOADER = "$(TEST_HOST)";
@@ -477,6 +474,7 @@
477474
MACOSX_DEPLOYMENT_TARGET = 12.0;
478475
MARKETING_VERSION = 1.0;
479476
OTHER_CODE_SIGN_FLAGS = "--deep";
477+
OTHER_LDFLAGS = "-all_load";
480478
PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.BenchmarkTests;
481479
PRODUCT_NAME = "$(TARGET_NAME)";
482480
REGISTER_APP_GROUPS = NO;
@@ -530,6 +528,10 @@
530528
/* End XCLocalSwiftPackageReference section */
531529

532530
/* Begin XCSwiftPackageProductDependency section */
531+
0314AE392E2AAEE700DDE821 /* executorch_llm */ = {
532+
isa = XCSwiftPackageProductDependency;
533+
productName = executorch_llm;
534+
};
533535
03F1814D2D7262FC0058BDF9 /* backend_coreml */ = {
534536
isa = XCSwiftPackageProductDependency;
535537
productName = backend_coreml;
@@ -546,10 +548,6 @@
546548
isa = XCSwiftPackageProductDependency;
547549
productName = executorch;
548550
};
549-
0314AE392E2AAEE700DDE821 /* executorch_llm */ = {
550-
isa = XCSwiftPackageProductDependency;
551-
productName = executorch_llm;
552-
};
553551
03F181552D7262FC0058BDF9 /* kernels_llm */ = {
554552
isa = XCSwiftPackageProductDependency;
555553
productName = kernels_llm;

extension/benchmark/apple/Benchmark/Tests/Tests.xcconfig

Lines changed: 0 additions & 12 deletions
This file was deleted.

install_requirements.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def python_is_compatible():
7171
#
7272
# NOTE: If you're changing, make the corresponding change in .ci/docker/ci_commit_pins/pytorch.txt
7373
# by picking the hash from the same date in https://hud.pytorch.org/hud/pytorch/pytorch/nightly/
74-
NIGHTLY_VERSION = "dev20250716"
74+
NIGHTLY_VERSION = "dev20250723"
7575

7676

7777
def install_requirements(use_pytorch_nightly):
Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1 @@
1-
#ifndef C10_MACROS_EXPORT_H_
2-
#define C10_MACROS_EXPORT_H_
3-
4-
#ifndef C10_USING_CUSTOM_GENERATED_MACROS
5-
#include <torch/headeronly/macros/cmake_macros.h>
6-
#endif // C10_USING_CUSTOM_GENERATED_MACROS
7-
81
#include <torch/headeronly/macros/Export.h>
9-
10-
// This one is being used by libtorch.so
11-
#ifdef CAFFE2_BUILD_MAIN_LIB
12-
#define TORCH_API C10_EXPORT
13-
#else
14-
#define TORCH_API C10_IMPORT
15-
#endif
16-
17-
// You may be wondering: Whose brilliant idea was it to split torch_cuda into
18-
// two pieces with confusing names?
19-
// Once upon a time, there _was_ only TORCH_CUDA_API. All was happy until we
20-
// tried to compile PyTorch for CUDA 11.1, which ran into relocation marker
21-
// issues when linking big binaries.
22-
// (https://github.com/pytorch/pytorch/issues/39968) We had two choices:
23-
// (1) Stop supporting so many GPU architectures
24-
// (2) Do something else
25-
// We chose #2 and decided to split the behemoth that was torch_cuda into two
26-
// smaller libraries, one with most of the core kernel functions (torch_cuda_cu)
27-
// and the other that had..well..everything else (torch_cuda_cpp). The idea was
28-
// this: instead of linking our static libraries (like the hefty
29-
// libcudnn_static.a) with another huge library, torch_cuda, and run into pesky
30-
// relocation marker issues, we could link our static libraries to a smaller
31-
// part of torch_cuda (torch_cuda_cpp) and avoid the issues.
32-
33-
// libtorch_cuda_cu.so
34-
#ifdef TORCH_CUDA_CU_BUILD_MAIN_LIB
35-
#define TORCH_CUDA_CU_API C10_EXPORT
36-
#elif defined(BUILD_SPLIT_CUDA)
37-
#define TORCH_CUDA_CU_API C10_IMPORT
38-
#endif
39-
40-
// libtorch_cuda_cpp.so
41-
#ifdef TORCH_CUDA_CPP_BUILD_MAIN_LIB
42-
#define TORCH_CUDA_CPP_API C10_EXPORT
43-
#elif defined(BUILD_SPLIT_CUDA)
44-
#define TORCH_CUDA_CPP_API C10_IMPORT
45-
#endif
46-
47-
// libtorch_cuda.so (where torch_cuda_cu and torch_cuda_cpp are a part of the
48-
// same api)
49-
#ifdef TORCH_CUDA_BUILD_MAIN_LIB
50-
#define TORCH_CUDA_CPP_API C10_EXPORT
51-
#define TORCH_CUDA_CU_API C10_EXPORT
52-
#elif !defined(BUILD_SPLIT_CUDA)
53-
#define TORCH_CUDA_CPP_API C10_IMPORT
54-
#define TORCH_CUDA_CU_API C10_IMPORT
55-
#endif
56-
57-
#if defined(TORCH_HIP_BUILD_MAIN_LIB)
58-
#define TORCH_HIP_CPP_API C10_EXPORT
59-
#define TORCH_HIP_API C10_EXPORT
60-
#else
61-
#define TORCH_HIP_CPP_API C10_IMPORT
62-
#define TORCH_HIP_API C10_IMPORT
63-
#endif
64-
65-
#if defined(TORCH_XPU_BUILD_MAIN_LIB)
66-
#define TORCH_XPU_API C10_EXPORT
67-
#else
68-
#define TORCH_XPU_API C10_IMPORT
69-
#endif
70-
71-
// Enums only need to be exported on windows for non-CUDA files
72-
#if defined(_WIN32) && defined(__CUDACC__)
73-
#define C10_API_ENUM C10_API
74-
#else
75-
#define C10_API_ENUM
76-
#endif
77-
78-
#endif // C10_MACROS_EXPORT_H_

0 commit comments

Comments
 (0)