Add conv tests #50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pull_mps | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }} | |
cancel-in-progress: true | |
jobs: | |
gather-models-mps: | |
runs-on: macos-executorch | |
outputs: | |
models: ${{ steps.gather-models-mps.outputs.models }} | |
mps_models: ${{ steps.gather-models-mps.outputs.mps_models }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: pip | |
- name: Extract the list of models to test | |
id: gather-models-mps | |
run: | | |
set -eux | |
if conda info --envs | grep -q "env-${{ runner.name }}"; then echo "env-${{ runner.name }} already exists"; else conda create -y -n "env-${{ runner.name }}"; fi | |
CONDA_ENV="~/miniconda3/envs/env-${{ runner.name }}" | |
if [[ -n "$CONDA_ENV" ]]; then | |
# Use binaries under conda environment | |
export PATH="$CONDA_ENV/bin":$PATH | |
fi | |
source ~/miniconda3/bin/activate | |
conda activate "$CONDA_ENV" | |
source .ci/scripts/utils.sh | |
# This is a simple Python script but as it tries to import executorch.examples.models, | |
# it requires a whole bunch of ExecuTorch dependencies on the Docker image | |
install_pip_dependencies | |
install_executorch | |
PYTHONPATH="${PWD}" python -m backends.apple.mps.ci.scripts.gather_test_models_mps | |
test-mps-models: | |
name: test-mps-models | |
runs-on: macos-executorch | |
needs: gather-models-mps | |
strategy: | |
matrix: ${{ fromJSON(needs.gather-models-mps.outputs.models) }} | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Run test ${{ matrix.test }} | |
if: always() | |
run: | | |
set -eux | |
if conda info --envs | grep -q "env-${{ runner.name }}"; then echo "base already exists"; else conda create -y -n "env-${{ runner.name }}"; fi | |
conda activate "env-${{ runner.name }}" | |
WORKSPACE=$(pwd) | |
pushd "${WORKSPACE}" | |
MODEL_NAME=${{ matrix.model }} | |
BUILD_TOOL=${{ matrix.build-tool }} | |
# Setup MacOS dependencies as there is no Docker support on MacOS atm | |
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-macos.sh "${BUILD_TOOL}" | |
PYTHON_EXECUTABLE=python bash backends/apple/mps/install_requirements.sh | |
# Build and test ExecuTorch | |
PYTHON_EXECUTABLE=python bash backends/apple/mps/ci/scripts/test-mps.sh "${MODEL_NAME}" "${BUILD_TOOL}" false | |
popd | |
test-mps: | |
name: test-mps | |
runs-on: macos-executorch | |
needs: gather-models-mps | |
strategy: | |
matrix: ${{ fromJSON(needs.gather-models-mps.outputs.mps_models) }} | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Run test ${{ matrix.test }} | |
if: always() | |
run: | | |
set -eux | |
if conda info --envs | grep -q "env-${{ runner.name }}"; then echo "base already exists"; else conda create -y -n "env-${{ runner.name }}"; fi | |
conda activate "env-${{ runner.name }}" | |
WORKSPACE=$(pwd) | |
pushd "${WORKSPACE}" | |
MODEL_NAME=${{ matrix.model }} | |
BUILD_TOOL=${{ matrix.build-tool }} | |
# Setup MacOS dependencies as there is no Docker support on MacOS atm | |
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-macos.sh "${BUILD_TOOL}" | |
PYTHON_EXECUTABLE=python bash backends/apple/mps/install_requirements.sh | |
# Build and test ExecuTorch | |
PYTHON_EXECUTABLE=python bash backends/apple/mps/ci/scripts/test-mps.sh "${MODEL_NAME}" "${BUILD_TOOL}" true | |
popd |