Each sub-project has its own developer guide. If you would like to work across projects, these instructions should help you get started:
Install shortfin dependencies
sudo apt update && sudo apt install -y clang lld
Install:
sudo apt install python-is-python3 python3-venv python3-dev
Or, alternatively, use `pyenv` to manage a separate python installation for more control over its version:
The following instructions are taken from pyenv's guide here: https://github.com/pyenv/pyenv?tab=readme-ov-file#a-getting-pyenv
First, install pyenv and its dependencies.
sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl git \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
curl https://pyenv.run | bash
Then, make pyenv available by adding the below to your ~/.bashrc
:
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
Finally, install a pyenv-managed version of python
pyenv install 3.12 # or whichever python version you'd like
pyenv local 3.12
Now, your python, pip, and venv should be managed by pyenv instead.
We recommend setting up a Python
virtual environment (venv).
The project is configured to ignore .venv
directories, and editors like
VSCode pick them up by default.
python -m venv .venv
source .venv/bin/activate
If no explicit action is taken, the default PyTorch version will be installed. This will give you a current CUDA-based version, which takes longer to download and includes other dependencies that SHARK does not require. To install a different variant, run one of these commands first:
-
CPU:
pip install -r pytorch-cpu-requirements.txt
-
ROCM:
pip install -r pytorch-rocm-requirements.txt
-
Other: see instructions at https://pytorch.org/get-started/locally/.
# Install editable local projects.
pip install -r requirements.txt -e sharktank/ shortfin/
# Optionally clone and install the latest editable iree-turbine dep in deps/,
# along with nightly versions of iree-base-compiler and iree-base-runtime.
pip install -f https://iree.dev/pip-release-links.html --upgrade --pre \
iree-base-compiler iree-base-runtime --src deps \
-e "git+https://github.com/iree-org/iree-turbine.git#egg=iree-turbine"
See also: nightly_releases.md.
pip install -r shortfin/requirements-tests.txt
pytest sharktank
pytest shortfin
pytest app_tests/integration_tests
This project is set up to use the pre-commit
tooling. To install it in
your local repo, run: pre-commit install
. After this point, when making
commits locally, hooks will run. See https://pre-commit.com/