Skip to content

Commit 9a1ddde

Browse files
committed
Update
[ghstack-poisoned]
1 parent da1df94 commit 9a1ddde

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

install_requirements.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ def clean():
7676
print("Done cleaning build artifacts.")
7777

7878

79+
VALID_PYBINDS = ["coreml", "mps", "xnnpack"]
80+
81+
7982
def main(args):
8083
if not python_is_compatible():
8184
sys.exit(1)
@@ -105,6 +108,11 @@ def main(args):
105108
help="build from the pinned PyTorch commit instead of nightly",
106109
)
107110
args = parser.parse_args(args)
111+
112+
if args.clean:
113+
clean()
114+
return
115+
108116
if args.pybind:
109117
# Flatten list of lists.
110118
args.pybind = list(itertools.chain(*args.pybind))
@@ -116,15 +124,13 @@ def main(args):
116124
EXECUTORCH_BUILD_PYBIND = "OFF"
117125
else:
118126
for pybind_arg in args.pybind:
119-
if pybind_arg not in ["coreml", "mps", "xnnpack"]:
120-
continue
127+
if pybind_arg not in VALID_PYBINDS:
128+
raise Exception(
129+
f"Unrecognized pybind argument {pybind_arg}; valid options are: {", ".join(VALID_PYBINDS)}"
130+
)
121131
EXECUTORCH_BUILD_PYBIND = "ON"
122132
CMAKE_ARGS += f" -DEXECUTORCH_BUILD_{pybind_arg.upper()}=ON"
123133

124-
if args.clean:
125-
clean()
126-
return
127-
128134
if args.use_pt_pinned_commit:
129135
# This option is used in CI to make sure that PyTorch build from the pinned commit
130136
# is used instead of nightly. CI jobs wouldn't be able to catch regression from the

0 commit comments

Comments
 (0)