1717from contextlib import contextmanager
1818from typing import List , Tuple
1919
20- from install_requirements import (
21- install_requirements ,
22- python_is_compatible ,
23- TORCH_NIGHTLY_URL ,
24- )
20+ from install_requirements import install_requirements , python_is_compatible , TORCH_URL
2521
2622# Set up logging
2723logging .basicConfig (
@@ -53,7 +49,7 @@ def clean():
5349
5450
5551# Please keep this insync with `ShouldBuild.pybindings` in setup.py.
56- VALID_PYBINDS = ["coreml" , "mps" , "xnnpack" , "training" , "openvino" ]
52+ VALID_PYBINDS = ["coreml" , "mps" , "xnnpack" , "training" ]
5753
5854
5955################################################################################
@@ -120,8 +116,8 @@ def check_folder(folder: str, file: str) -> bool:
120116 if missing_submodules :
121117 logger .warning ("Some required submodules are missing. Updating submodules..." )
122118 try :
123- subprocess .check_call (["git" , "submodule" , "sync" ])
124- subprocess .check_call (["git" , "submodule" , "update" , "--init" ])
119+ subprocess .check_call (["git" , "submodule" , "sync" , "--recursive" ])
120+ subprocess .check_call (["git" , "submodule" , "update" , "--init" , "--recursive" ])
125121 except subprocess .CalledProcessError as e :
126122 logger .error (f"Error updating submodules: { e } " )
127123 exit (1 )
@@ -130,13 +126,8 @@ def check_folder(folder: str, file: str) -> bool:
130126 for path , file in missing_submodules .items ():
131127 if not check_folder (path , file ):
132128 logger .error (f"{ file } not found in { path } ." )
133- logger .error ("Please run `git submodule update --init` ." )
129+ logger .error ("Submodule update failed. Please run `git submodule update --init --recursive` manually ." )
134130 exit (1 )
135- # Go into tokenizers submodule and install its submodules
136- tokenizers_path = get_required_submodule_paths ().get ("tokenizers" , None )
137- if tokenizers_path :
138- with pushd (tokenizers_path ):
139- subprocess .check_call (["git" , "submodule" , "update" , "--init" ])
140131 logger .info ("All required submodules are present." )
141132
142133
@@ -207,10 +198,14 @@ def main(args):
207198 use_pytorch_nightly = True
208199
209200 wants_pybindings_off , pybind_defines = _list_pybind_defines (args )
210- if wants_pybindings_off :
211- cmake_args .append ("-DEXECUTORCH_BUILD_PYBIND=OFF" )
212- else :
213- cmake_args += pybind_defines
201+ if not wants_pybindings_off :
202+ if len (pybind_defines ) > 0 :
203+ # If the user explicitly provides a list of bindings, just use them
204+ cmake_args += pybind_defines
205+ else :
206+ # If the user has not set pybindings off but also has not provided
207+ # a list, then turn on xnnpack by default
208+ cmake_args .append ("-DEXECUTORCH_BUILD_XNNPACK=ON" )
214209
215210 if args .clean :
216211 clean ()
@@ -256,7 +251,7 @@ def main(args):
256251 "--no-build-isolation" ,
257252 "-v" ,
258253 "--extra-index-url" ,
259- TORCH_NIGHTLY_URL ,
254+ TORCH_URL ,
260255 ],
261256 check = True ,
262257 )
0 commit comments