From 28daf410b6be36afd78e645607349581b9ec6c4b Mon Sep 17 00:00:00 2001 From: Vivek Khandelwal Date: Tue, 27 Sep 2022 20:03:39 +0530 Subject: [PATCH] Add instructions to use locally build Torch-MLIR with SHARK --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 76c4644c..2da0eda6 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,21 @@ with Python bindings and set your PYTHONPATH as mentioned [here](https://google. for IREE and [here](https://github.com/llvm/torch-mlir/blob/main/development.md#setup-python-environment-to-export-the-built-python-packages) for Torch-MLIR. +### How to use your locally build Torch-MLIR with SHARK +```shell +1.) Run `./setup_venv.sh in SHARK` and activate `shark.venv` virtual env. +2.) Run `pip uninstall torch-mlir`. +3.) Go to your local Torch-MLIR directory. +4.) Activate mlir_venv virtual envirnoment. +5.) Run `pip uninstall -r requirements.txt`. +6.) Run `pip install -r requirements.txt`. +7.) Build Torch-MLIR. +8.) Activate shark.venv virtual environment from the Torch-MLIR directory. +8.) Run `export PYTHONPATH=`pwd`/build/tools/torch-mlir/python_packages/torch_mlir:`pwd`/examples` in the Torch-MLIR directory. +9.) Go to the SHARK directory. +``` +Now the SHARK will use your locally build Torch-MLIR repo. + ### Run a demo script ```shell python -m shark.examples.shark_inference.resnet50_script --device="cpu" # Use gpu | vulkan @@ -94,7 +109,6 @@ python -m shark.examples.shark_inference.resnet50_script --device="cpu" # Use g pytest tank/tf/hf_masked_lm/albert-base-v2_test.py::AlbertBaseModuleTest::test_module_static_cpu ``` -