1515# The pip repository that hosts nightly torch packages.
1616# This will be dynamically set based on CUDA availability and CUDA backend enabled/disabled.
1717TORCH_URL_BASE = "https://download.pytorch.org/whl/test"
18+ TORCHAO_URL_BASE = "https://download.pytorch.org/whl/nightly"
19+ TORCHAO_NIGHTLY_VERSION = "0.18.0.dev20260715"
1820
1921# Since ExecuTorch often uses main-branch features of pytorch, only the nightly
2022# pip versions will have the required features.
@@ -43,13 +45,15 @@ def install_requirements(use_pytorch_nightly):
4345
4446 # Determine the appropriate PyTorch URL based on CUDA delegate status
4547 torch_url = determine_torch_url (TORCH_URL_BASE )
48+ torchao_url = determine_torch_url (TORCHAO_URL_BASE )
4649
4750 # pip packages needed by exir.
4851 TORCH_PACKAGE = [
4952 # Setting use_pytorch_nightly to false to test the pinned PyTorch commit. Note
5053 # that we don't need to set any version number there because they have already
5154 # been installed on CI before this step, so pip won't reinstall them
52- ("torch==2.12.0" if use_pytorch_nightly else "torch" ),
55+ ("torch==2.13.0" if use_pytorch_nightly else "torch" ),
56+ f"torchao=={ TORCHAO_NIGHTLY_VERSION } " ,
5357 ]
5458
5559 # Install the requirements for core ExecuTorch package.
@@ -66,44 +70,45 @@ def install_requirements(use_pytorch_nightly):
6670 * TORCH_PACKAGE ,
6771 "--extra-index-url" ,
6872 torch_url ,
73+ "--extra-index-url" ,
74+ torchao_url ,
6975 ],
7076 check = True ,
7177 )
7278
73- LOCAL_REQUIREMENTS = [
74- "third-party/ao" , # We need the latest kernels for fast iteration, so not relying on pypi.
75- ] + (
79+ LOCAL_REQUIREMENTS = (
7680 [
7781 "extension/llm/tokenizers" , # TODO(larryliu0820): Setup a pypi package for this.
7882 ]
7983 if sys .platform != "win32"
8084 else []
8185 ) # TODO(gjcomer): Re-enable when buildable on Windows.
8286
83- # Install packages directly from local copy instead of pypi.
84- # This is usually not recommended.
85- new_env = os .environ .copy ()
86- if ("EXECUTORCH_BUILD_KERNELS_TORCHAO" not in new_env ) or (
87- new_env ["EXECUTORCH_BUILD_KERNELS_TORCHAO" ] == "0"
88- ):
89- new_env ["USE_CPP" ] = "0"
90- else :
91- assert new_env ["EXECUTORCH_BUILD_KERNELS_TORCHAO" ] == "1"
92- new_env ["USE_CPP" ] = "1"
93- new_env ["CMAKE_POLICY_VERSION_MINIMUM" ] = "3.5"
94- subprocess .run (
95- [
96- sys .executable ,
97- "-m" ,
98- "pip" ,
99- "install" ,
100- # Without --no-build-isolation, setup.py can't find the torch module.
101- "--no-build-isolation" ,
102- * LOCAL_REQUIREMENTS ,
103- ],
104- env = new_env ,
105- check = True ,
106- )
87+ if LOCAL_REQUIREMENTS :
88+ # Install packages directly from local copy instead of pypi.
89+ # This is usually not recommended.
90+ new_env = os .environ .copy ()
91+ if ("EXECUTORCH_BUILD_KERNELS_TORCHAO" not in new_env ) or (
92+ new_env ["EXECUTORCH_BUILD_KERNELS_TORCHAO" ] == "0"
93+ ):
94+ new_env ["USE_CPP" ] = "0"
95+ else :
96+ assert new_env ["EXECUTORCH_BUILD_KERNELS_TORCHAO" ] == "1"
97+ new_env ["USE_CPP" ] = "1"
98+ new_env ["CMAKE_POLICY_VERSION_MINIMUM" ] = "3.5"
99+ subprocess .run (
100+ [
101+ sys .executable ,
102+ "-m" ,
103+ "pip" ,
104+ "install" ,
105+ # Without --no-build-isolation, setup.py can't find the torch module.
106+ "--no-build-isolation" ,
107+ * LOCAL_REQUIREMENTS ,
108+ ],
109+ env = new_env ,
110+ check = True ,
111+ )
107112
108113
109114def install_optional_example_requirements (use_pytorch_nightly ):
@@ -112,7 +117,7 @@ def install_optional_example_requirements(use_pytorch_nightly):
112117
113118 print ("Installing torch domain libraries" )
114119 DOMAIN_LIBRARIES = [
115- ("torchvision==0.27 .0" if use_pytorch_nightly else "torchvision" ),
120+ ("torchvision==0.28 .0" if use_pytorch_nightly else "torchvision" ),
116121 ("torchaudio==2.11.0" if use_pytorch_nightly else "torchaudio" ),
117122 ]
118123 # Then install domain libraries
0 commit comments