Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into shortfin-docker-rust
Browse files Browse the repository at this point in the history
# Conflicts:
#	shortfin/build_tools/build_linux_package.sh
  • Loading branch information
ScottTodd committed Dec 17, 2024
2 parents 00fa7da + d08b0e5 commit 4fa0d51
Show file tree
Hide file tree
Showing 55 changed files with 2,413 additions and 517 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/ci-libshortfin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ name: CI - shortfin
on:
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/ci-libshortfin.yml'
- 'shortfin/**'
push:
branches:
- main
paths:
- '.github/workflows/ci-libshortfin.yml'
- 'shortfin/**'

permissions:
contents: read
Expand Down Expand Up @@ -152,3 +146,22 @@ jobs:
run: |
ctest --timeout 30 --output-on-failure --test-dir build
pytest -s --durations=10
# Depends on all other jobs to provide an aggregate job status.
ci_libshortfin_summary:
if: always()
runs-on: ubuntu-24.04
needs:
- build-and-test
steps:
- name: Getting failed jobs
run: |
echo '${{ toJson(needs) }}'
FAILED_JOBS="$(echo '${{ toJson(needs) }}' \
| jq --raw-output \
'map_values(select(.result!="success" and .result!="skipped")) | keys | join(",")' \
)"
if [[ "${FAILED_JOBS}" != "" ]]; then
echo "The following jobs failed: ${FAILED_JOBS}"
exit 1
fi
4 changes: 3 additions & 1 deletion .github/workflows/ci-llama-large-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ jobs:
run: |
source ${VENV_DIR}/bin/activate
python -m pip install --no-compile --upgrade pip
# Note: We install in three steps in order to satisfy requirements
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
# Install nightly IREE packages.
# We could also pin to a known working or stable version.
Expand All @@ -66,6 +66,8 @@ jobs:
iree-base-runtime \
iree-turbine
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
pip freeze
- name: Run llama tests
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-llama-quick-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ jobs:
run: |
source ${VENV_DIR}/bin/activate
python -m pip install --no-compile --upgrade pip
# Note: We install in three steps in order to satisfy requirements
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
# Install nightly IREE packages.
# We could also pin to a known working or stable version.
Expand All @@ -66,6 +66,7 @@ jobs:
iree-base-runtime \
iree-turbine
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
pip freeze
- name: Run llama 8b f16 decomposed test
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci-sglang-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ jobs:
run: |
source ${VENV_DIR}/bin/activate
python -m pip install --no-compile --upgrade pip
# Note: We install in three steps in order to satisfy requirements
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -e sharktank/ shortfin/
# Use newest possible releases to be able to track commits that may
# cause errors.
Expand All @@ -64,6 +64,8 @@ jobs:
iree-turbine \
"numpy<2.0"
pip install --no-compile -r requirements.txt -e sharktank/ shortfin/
# Install SGLang and sentence_transformers
pip install "git+https://github.com/nod-ai/sglang.git#subdirectory=python"
pip install sentence_transformers
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci-shark-ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ jobs:
run: |
source ${VENV_DIR}/bin/activate
python -m pip install --no-compile --upgrade pip
# Note: We install in three steps in order to satisfy requirements
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -e sharktank/ shortfin/
# Install nightly IREE packages.
# We could also pin to a known working or stable version.
Expand All @@ -62,6 +62,8 @@ jobs:
iree-base-runtime \
iree-turbine
pip install --no-compile -r requirements.txt -e sharktank/ shortfin/
pip freeze
- name: Run LLM Integration Tests
Expand Down
74 changes: 60 additions & 14 deletions .github/workflows/ci-sharktank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,23 @@ concurrency:

jobs:
test:
name: "Unit Tests and Type Checking"
name: "Unit Tests (${{ matrix.os }}, ${{ matrix.python-version }}, ${{ matrix.torch-version }})"
strategy:
matrix:
version: [3.11]
os: [ubuntu-24.04, windows-2022]
python-version: ["3.11", "3.12"]
torch-version: ["2.3.0", "2.4.1", "2.5.1"]
os: [ubuntu-24.04]
include:
- os: windows-2022
python-version: "3.11"
torch-version: "2.3.0"
- os: windows-2022
python-version: "3.12"
torch-version: "2.4.1"
exclude:
- python-version: "3.12"
# `torch.compile` requires torch>=2.4.0 for Python 3.12+
torch-version: "2.3.0"
fail-fast: false
runs-on: ${{matrix.os}}
defaults:
Expand All @@ -42,7 +54,7 @@ jobs:
id: setup_python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{matrix.version}}
python-version: ${{matrix.python-version}}

- name: Cache Pip Packages
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
Expand All @@ -51,14 +63,18 @@ jobs:
path: ${{ env.PIP_CACHE_DIR }}
key: pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('*requirements*.txt','sharktank/requirements*.txt') }}

- name: Install numpy
if: ${{ matrix.os == 'windows-2022' && matrix.torch-version == '2.3.0' }}
run: pip install "numpy<2.0"

- name: Install pip deps
run: |
python -m pip install --no-compile --upgrade pip
# Note: We install in three steps in order to satisfy requirements
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
pip install --no-compile --pre --index-url https://download.pytorch.org/whl/test/cpu torch==${{matrix.torch-version}}+cpu
# Install nightly IREE packages.
# We could also pin to a known working or stable version.
Expand All @@ -67,6 +83,8 @@ jobs:
iree-base-runtime \
iree-turbine
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
- name: Run sharktank tests
if: ${{ !cancelled() }}
run: |
Expand All @@ -77,7 +95,7 @@ jobs:
name: "Data-dependent Tests"
strategy:
matrix:
version: [3.11]
python-version: [3.11]
runs-on: [llama-mi300x-3]
fail-fast: false
runs-on: ${{matrix.runs-on}}
Expand All @@ -94,7 +112,7 @@ jobs:
id: setup_python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{matrix.version}}
python-version: ${{matrix.python-version}}

- name: Create Python venv
run: python -m venv ${VENV_DIR}
Expand All @@ -107,7 +125,6 @@ jobs:
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
# Install nightly IREE packages.
# We could also pin to a known working or stable version.
Expand All @@ -116,16 +133,22 @@ jobs:
iree-base-runtime \
iree-turbine
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
- name: Run tests
# TODO: unify with-t5-data and with-clip-data flags into a single flag
# and make it possible to run only tests that require data.
# TODO: unify with-*-data flags into a single flag and make it possible to run
# only tests that require data.
# We would still want the separate flags as we may endup with data being
# scattered on different CI machines.
run: |
source ${VENV_DIR}/bin/activate
pytest \
--with-clip-data \
--with-clip-data \
--with-flux-data \
--with-t5-data \
sharktank/tests/models/clip/clip_test.py \
sharktank/tests/models/t5/t5_test.py \
sharktank/tests/models/flux/flux_test.py \
--durations=0
Expand Down Expand Up @@ -153,19 +176,42 @@ jobs:
- name: Install pip deps
run: |
python -m pip install --no-compile --upgrade pip
# Note: We install in three steps in order to satisfy requirements
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
# Install nightly IREE packages.
# We could also pin to a known working or stable version.
pip install -f https://iree.dev/pip-release-links.html --pre --upgrade \
pip install -f https://iree.dev/pip-release-links.html --pre \
iree-base-compiler \
iree-base-runtime \
iree-turbine
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
- name: Run punet tests
run: |
pytest -v sharktank/ -m punet_quick \
--durations=0
# Depends on other jobs to provide an aggregate job status.
# TODO(#584): move test_with_data and test_integration to a pkgci integration test workflow?
ci_sharktank_summary:
if: always()
runs-on: ubuntu-24.04
needs:
- test
steps:
- name: Getting failed jobs
run: |
echo '${{ toJson(needs) }}'
FAILED_JOBS="$(echo '${{ toJson(needs) }}' \
| jq --raw-output \
'map_values(select(.result!="success" and .result!="skipped")) | keys | join(",")' \
)"
if [[ "${FAILED_JOBS}" != "" ]]; then
echo "The following jobs failed: ${FAILED_JOBS}"
exit 1
fi
9 changes: 6 additions & 3 deletions .github/workflows/ci_eval.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,20 @@ jobs:
run: |
source ${VENV_DIR}/bin/activate
python -m pip install --no-compile --upgrade pip
# Note: We install in three steps in order to satisfy requirements
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
# Install nightly IREE packages.
# We could also pin to a known working or stable version.
pip install -f https://iree.dev/pip-release-links.html --pre \
pip install -f https://iree.dev/pip-release-links.html --pre --upgrade \
iree-base-compiler \
iree-base-runtime \
iree-turbine
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
pip freeze
- name: Run perplexity test with IREE
Expand Down Expand Up @@ -109,17 +110,19 @@ jobs:
run: |
source ${VENV_DIR}/bin/activate
python -m pip install --no-compile --upgrade pip
# Note: We install in three steps in order to satisfy requirements
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
# Install nightly iree-turbine.
# We could also pin to a known working or stable version.
pip install -f https://iree.dev/pip-release-links.html --pre --upgrade \
iree-turbine
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
- name: Run perplexity test with Torch
run: |
source ${VENV_DIR}/bin/activate
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci_eval_short.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ jobs:
run: |
source ${VENV_DIR}/bin/activate
python -m pip install --no-compile --upgrade pip
# Note: We install in three steps in order to satisfy requirements
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
# Install nightly IREE packages.
# We could also pin to a known working or stable version.
Expand All @@ -63,6 +63,7 @@ jobs:
iree-base-runtime \
iree-turbine
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
pip freeze
- name: Run perplexity test with vmfb
Expand Down
24 changes: 11 additions & 13 deletions build_tools/python_deploy/write_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def write_requirements(requirements):
metapackage_version = load_version_info(VERSION_FILE_LOCAL)
PACKAGE_VERSION = metapackage_version.get("package-version")

# sharktank_version = load_version_info(VERSION_FILE_SHARKTANK)
# SHARKTANK_PACKAGE_VERSION = sharktank_version.get("package-version")
sharktank_version = load_version_info(VERSION_FILE_SHARKTANK)
SHARKTANK_PACKAGE_VERSION = sharktank_version.get("package-version")

shortfin_version = load_version_info(VERSION_FILE_SHORTFIN)
SHORTFIN_PACKAGE_VERSION = shortfin_version.get("package-version")
Expand All @@ -65,13 +65,12 @@ def write_requirements(requirements):
requirements = ""
for package in stable_packages_list:
requirements += package + "\n"
# TODO: Include sharktank as a dependencies of future releases
# requirements = (
# "sharktank=="
# + Version(SHARKTANK_PACKAGE_VERSION).base_version
# + args.version_suffix
# + "\n"
# )
requirements = (
"sharktank=="
+ Version(SHARKTANK_PACKAGE_VERSION).base_version
+ args.version_suffix
+ "\n"
)
requirements += (
"shortfin=="
+ Version(SHORTFIN_PACKAGE_VERSION).base_version
Expand All @@ -89,10 +88,9 @@ def write_requirements(requirements):
requirements = ""
for package in stable_packages_list:
requirements += package + "==" + STABLE_VERSION_TO_PIN + "\n"
# TODO: Include sharktank as a dependencies of future releases
# requirements += (
# "sharktank==" + Version(SHARKTANK_PACKAGE_VERSION).base_version + "\n"
# )
requirements += (
"sharktank==" + Version(SHARKTANK_PACKAGE_VERSION).base_version + "\n"
)
requirements += "shortfin==" + Version(SHORTFIN_PACKAGE_VERSION).base_version

write_requirements(requirements)
Loading

0 comments on commit 4fa0d51

Please sign in to comment.