@@ -69,6 +69,7 @@ def python_is_compatible():
6969EXECUTORCH_BUILD_PYBIND = "OFF"
7070CMAKE_ARGS = os .getenv ("CMAKE_ARGS" , "" )
7171CMAKE_BUILD_ARGS = os .getenv ("CMAKE_BUILD_ARGS" , "" )
72+ USE_PYTORCH_NIGHTLY = True
7273
7374for arg in sys .argv [1 :]:
7475 if arg == "--pybind" :
@@ -90,6 +91,11 @@ def python_is_compatible():
9091 shutil .rmtree (d , ignore_errors = True )
9192 print ("Done cleaning build artifacts." )
9293 sys .exit (0 )
94+ elif arg == "--use-pt-pinned-commit" :
95+ # This option is used in CI to make sure that PyTorch build from the pinned commit
96+ # is used instead of nightly. CI jobs wouldn't be able to catch regression from the
97+ # latest PT commit otherwise
98+ USE_PYTORCH_NIGHTLY = False
9399 else :
94100 print (f"Error: Unknown option { arg } " )
95101 sys .exit (1 )
@@ -113,11 +119,27 @@ def python_is_compatible():
113119
114120# pip packages needed by exir.
115121EXIR_REQUIREMENTS = [
116- f"torch==2.6.0.{ NIGHTLY_VERSION } " ,
117- f"torchvision==0.20.0.{ NIGHTLY_VERSION } " , # For testing.
122+ # Setting USE_PYTORCH_NIGHTLY to false to test the pinned PyTorch commit. Note
123+ # that we don't need to set any version number there because they have already
124+ # been installed on CI before this step, so pip won't reinstall them
125+ f"torch==2.6.0.{ NIGHTLY_VERSION } " if USE_PYTORCH_NIGHTLY else "torch" ,
126+ (
127+ f"torchvision==0.20.0.{ NIGHTLY_VERSION } "
128+ if USE_PYTORCH_NIGHTLY
129+ else "torchvision"
130+ ), # For testing.
118131 "typing-extensions" ,
119132]
120133
134+ # pip packages needed to run examples.
135+ # TODO: Make each example publish its own requirements.txt
136+ EXAMPLES_REQUIREMENTS = [
137+ "timm==1.0.7" ,
138+ f"torchaudio==2.5.0.{ NIGHTLY_VERSION } " if USE_PYTORCH_NIGHTLY else "torchaudio" ,
139+ "torchsr==1.0.4" ,
140+ "transformers==4.42.4" ,
141+ ]
142+
121143# pip packages needed for development.
122144DEVEL_REQUIREMENTS = [
123145 "cmake" , # For building binary targets.
@@ -129,15 +151,6 @@ def python_is_compatible():
129151 "zstd" , # Imported by resolve_buck.py.
130152]
131153
132- # pip packages needed to run examples.
133- # TODO: Make each example publish its own requirements.txt
134- EXAMPLES_REQUIREMENTS = [
135- "timm==1.0.7" ,
136- f"torchaudio==2.5.0.{ NIGHTLY_VERSION } " ,
137- "torchsr==1.0.4" ,
138- "transformers==4.42.4" ,
139- ]
140-
141154# Assemble the list of requirements to actually install.
142155# TODO: Add options for reducing the number of requirements.
143156REQUIREMENTS_TO_INSTALL = EXIR_REQUIREMENTS + DEVEL_REQUIREMENTS + EXAMPLES_REQUIREMENTS
0 commit comments