diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index e50c92171d8a..2489d5220326 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -29,7 +29,7 @@ jobs: python -m pip install -r $GITHUB_WORKSPACE/externals/llvm-project/mlir/python/requirements.txt - name: Install PyTorch nightly depends run: | - python -m pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html + python -m pip install -r requirements.txt - name: Install Ninja uses: llvm/actions/install-ninja@55d844821959226fab4911f96f37071c1d4c3268 - name: Get Submodule Hash diff --git a/build_tools/build_python_wheels.sh b/build_tools/build_python_wheels.sh index 36a0b1e00b81..905ae4c0a2ec 100755 --- a/build_tools/build_python_wheels.sh +++ b/build_tools/build_python_wheels.sh @@ -24,7 +24,7 @@ python -m venv "$package_test_venv" VENV_PYTHON="$package_test_venv/bin/python" echo "---- INSTALLING torch ----" -$VENV_PYTHON -m pip install --pre torch torchvision pybind11 -f "https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html" +$VENV_PYTHON -m pip install -r "${repo_root}/requirements.txt" echo "---- INSTALLING other deps for smoke test ----" $VENV_PYTHON -m pip install requests pillow echo "---- INSTALLING torch-mlir ----" diff --git a/requirements.txt b/requirements.txt index 45e653a35ac2..ead7c8ebf5f4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,8 +2,9 @@ --pre numpy -torch -torchvision +# TODO: Fix for latest PyTorch. +torch==1.12.0.dev20220328+cpu +torchvision==0.13.0.dev20220328+cpu # Build requirements. pybind11 diff --git a/setup.py b/setup.py index 34c607dc1d94..86ca6e7dc134 100644 --- a/setup.py +++ b/setup.py @@ -51,11 +51,12 @@ def run(self): target_dir = self.build_lib cmake_build_dir = os.getenv("TORCH_MLIR_CMAKE_BUILD_DIR") if not cmake_build_dir: - cmake_build_dir = os.path.join(target_dir, "..", "cmake_build") + cmake_build_dir = os.path.abspath( + os.path.join(target_dir, "..", "cmake_build")) if not os.getenv("TORCH_MLIR_CMAKE_BUILD_DIR_ALREADY_BUILT"): src_dir = os.path.abspath(os.path.dirname(__file__)) llvm_dir = os.path.join( - src_dir, "external", "llvm-project", "llvm") + src_dir, "externals", "llvm-project", "llvm") cmake_args = [ f"-DCMAKE_BUILD_TYPE=Release", f"-DPython3_EXECUTABLE={sys.executable}", @@ -64,7 +65,7 @@ def run(self): f"-DLLVM_ENABLE_PROJECTS=mlir", f"-DLLVM_EXTERNAL_PROJECTS=torch-mlir;torch-mlir-dialects", f"-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR={src_dir}", - f"-DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR={src_dir}/external/llvm-external-projects/torch-mlir-dialects", + f"-DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR={src_dir}/externals/llvm-external-projects/torch-mlir-dialects", # Optimization options for building wheels. f"-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON", f"-DCMAKE_C_VISIBILITY_PRESET=hidden",