Skip to content

Commit

Permalink
Merge branch 'main' into docs-shortfin-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottTodd authored Nov 14, 2024
2 parents 8b7262b + f429c91 commit b309a15
Show file tree
Hide file tree
Showing 20 changed files with 794 additions and 222 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-shark-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
# Try with the latest IREE nightly releases, not what iree-turbine pins.
# We could also pin to a known working or stable version.
# This should eventually stabilize. Do the best we can for now.
pip install -f https://iree.dev/pip-release-links.html --upgrade \
pip install -f https://iree.dev/pip-release-links.html --upgrade --pre \
iree-base-compiler \
iree-base-runtime \
"numpy<2.0"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-sharktank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
# Update to the latest iree packages.
pip install -f https://iree.dev/pip-release-links.html --upgrade \
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"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-tuner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
pip install -r tuner/requirements-tuner.txt
python -m pip install \
--find-links https://iree.dev/pip-release-links.html \
--upgrade \
--upgrade --pre \
iree-base-compiler iree-base-runtime
- name: Run tuner tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_eval.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
# Try with the latest IREE nightly releases, not what iree-turbine pins.
# We could also pin to a known working or stable version.
# This should eventually stabilize. Do the best we can for now.
pip install -f https://iree.dev/pip-release-links.html --upgrade \
pip install -f https://iree.dev/pip-release-links.html --upgrade --pre \
iree-base-compiler \
iree-base-runtime \
"numpy<2.0"
Expand Down
88 changes: 50 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
# SHARK Modeling and Serving Libraries

**WARNING: This is an early preview that is in progress. It is not ready for
general use.**
> [!IMPORTANT]
> Development is still in progress for several project components. See the
> notes below for which workflows are best supported.
![GitHub License](https://img.shields.io/github/license/nod-ai/SHARK-Platform)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)

<!-- TODO: high level overview, features when components are used together -->

## Sub-projects

### [`shortfin/`](./shortfin/)

<!-- TODO: features list here? -->

[![PyPI version](https://badge.fury.io/py/shortfin.svg)](https://badge.fury.io/py/shortfin) [![CI - shortfin](https://github.com/nod-ai/SHARK-Platform/actions/workflows/ci_linux_x64-libshortfin.yml/badge.svg?event=push)](https://github.com/nod-ai/SHARK-Platform/actions/workflows/ci_linux_x64-libshortfin.yml?query=event%3Apush)

The shortfin sub-project is SHARK's high performance inference library and
serving engine.

* API documentation for shortfin is available on
[readthedocs](https://shortfin.readthedocs.io/en/latest/).

### [`sharktank/`](./sharktank/)

[![PyPI version](https://badge.fury.io/py/sharktank.svg)](https://badge.fury.io/py/sharktank) [![CI - sharktank](https://github.com/nod-ai/SHARK-Platform/actions/workflows/ci-sharktank.yml/badge.svg?event=push)](https://github.com/nod-ai/SHARK-Platform/actions/workflows/ci-sharktank.yml?query=event%3Apush)

The SHARK Tank sub-project contains a collection of model recipes and
conversion tools to produce inference-optimized programs.

> [!WARNING]
> SHARK Tank is still under development. Experienced users may want to try it
> out, but we currently recommend most users download pre-exported or
> pre-compiled model files for serving with shortfin.
<!-- TODO: features list here? -->

* See the [SHARK Tank Programming Guide](./docs/programming_guide.md) for
Expand All @@ -25,18 +43,6 @@ conversion tools to produce inference-optimized programs.
* See [Direct Quantization with SHARK Tank](./docs/quantization.md)
for information about quantization support.

### [`shortfin/`](./shortfin/)

<!-- TODO: features list here? -->

[![PyPI version](https://badge.fury.io/py/shortfin.svg)](https://badge.fury.io/py/shortfin) [![CI - shortfin](https://github.com/nod-ai/SHARK-Platform/actions/workflows/ci_linux_x64-libshortfin.yml/badge.svg?event=push)](https://github.com/nod-ai/SHARK-Platform/actions/workflows/ci_linux_x64-libshortfin.yml?query=event%3Apush)

The shortfin sub-project is SHARK's high performance inference library and
serving engine.

* API documentation for shortfin is available on
[readthedocs](https://shortfin.readthedocs.io/en/latest/).

### [`tuner/`](./tuner/)

[![CI - Tuner](https://github.com/nod-ai/SHARK-Platform/actions/workflows/ci-tuner.yml/badge.svg?event=push)](https://github.com/nod-ai/SHARK-Platform/actions/workflows/ci-tuner.yml?query=event%3Apush)
Expand All @@ -55,56 +61,62 @@ Model name | Model recipes | Serving apps
SDXL | [`sharktank/sharktank/models/punet/`](https://github.com/nod-ai/SHARK-Platform/tree/main/sharktank/sharktank/models/punet) | [`shortfin/python/shortfin_apps/sd/`](https://github.com/nod-ai/SHARK-Platform/tree/main/shortfin/python/shortfin_apps/sd)
llama | [`sharktank/sharktank/models/llama/`](https://github.com/nod-ai/SHARK-Platform/tree/main/sharktank/sharktank/models/llama) | [`shortfin/python/shortfin_apps/llm/`](https://github.com/nod-ai/SHARK-Platform/tree/main/shortfin/python/shortfin_apps/llm)

## Development getting started
## Development tips

<!-- TODO: Remove or update this section. Common setup for all projects? -->

Use this as a guide to get started developing the project using pinned,
pre-release dependencies. You are welcome to deviate as you see fit, but
these canonical directions mirror what the CI does.
Each sub-project has its own developer guide. If you would like to work across
projects, these instructions should help you get started:

### Setup a venv

We recommend setting up a virtual environment (venv). The project is configured
to ignore `.venv` directories, and editors like VSCode pick them up by default.
We recommend setting up a Python
[virtual environment (venv)](https://docs.python.org/3/library/venv.html).
The project is configured to ignore `.venv` directories, and editors like
VSCode pick them up by default.

```
```bash
python -m venv .venv
source .venv/bin/activate
```

### Install PyTorch for your system

If no explicit action is taken, the default PyTorch version will be installed.
This will give you a current CUDA-based version. Install a different variant
by doing so explicitly first:
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:*
* *CPU:*

```
pip install -r pytorch-cpu-requirements.txt
```
```bash
pip install -r pytorch-cpu-requirements.txt
```

*ROCM:*
* *ROCM:*

```
pip install -r pytorch-rocm-requirements.txt
```
```bash
pip install -r pytorch-rocm-requirements.txt
```

* *Other:* see instructions at <https://pytorch.org/get-started/locally/>.

### Install development packages

```
```bash
# Install editable local projects.
pip install -r requirements.txt -e sharktank/ shortfin/
# Optionally clone and install editable iree-turbine dep in deps/
pip install -f https://iree.dev/pip-release-links.html --src deps \
# 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: [`docs/nightly_releases.md`](./docs/nightly_releases.md).

### Running tests

```
```bash
pytest sharktank
pytest shortfin
```
Expand Down
10 changes: 5 additions & 5 deletions docs/nightly_releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ python3.11 -m venv 3.11.venv
source 3.11.venv/bin/activate

# Install 'sharktank' package from nightly releases.
python -m pip install sharktank -f https://github.com/nod-ai/SHARK-Platform/releases/expanded_assets/dev-wheels
pip install sharktank -f https://github.com/nod-ai/SHARK-Platform/releases/expanded_assets/dev-wheels

# Test the installation.
python -c "from sharktank import ops; print('Sanity check passed')"
Expand All @@ -84,7 +84,7 @@ python3.11 -m venv 3.11.venv
source 3.11.venv/bin/activate

# Install 'shortfin' package from nightly releases.
python -m pip install shortfin -f https://github.com/nod-ai/SHARK-Platform/releases/expanded_assets/dev-wheels
pip install shortfin -f https://github.com/nod-ai/SHARK-Platform/releases/expanded_assets/dev-wheels

# Test the installation.
python -c "import shortfin as sf; print('Sanity check passed')"
Expand All @@ -98,22 +98,22 @@ deactivate
To install the `iree-turbine` package from the latest source:

```bash
python -m pip install --src deps \
pip install --src deps \
-e "git+https://github.com/iree-org/iree-turbine.git#egg=iree-turbine"
```

To install the `iree-base-compiler` and `iree-base-runtime` packages from
nightly releases:

```bash
python -m pip install -f https://iree.dev/pip-release-links.html --upgrade \
pip install -f https://iree.dev/pip-release-links.html --upgrade --pre \
iree-base-compiler iree-base-runtime
```

To install all three packages together:

```bash
python -m pip install -f https://iree.dev/pip-release-links.html --upgrade \
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"
```
Loading

0 comments on commit b309a15

Please sign in to comment.