Skip to content

Commit

Permalink
Add export unit test CI workflow
Browse files Browse the repository at this point in the history
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
  • Loading branch information
larryliu0820 committed Nov 22, 2024
1 parent 3626414 commit 0c772b1
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/export.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Export

on:
push:
branches: [ main ]
pull_request:

concurrency:
group: unit-test${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -l -eo pipefail {0}

jobs:
unit_tests:
if: github.repository_owner == 'pytorch'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniconda-version: "latest"
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: |
bash torchtune/modules/_export/install_requirements.sh
python -m pip install torchao
python -m pip install -e ".[dev]"
- name: Run unit tests with coverage
run: pytest tests --cov=. --cov-report=xml --durations=20 -vv
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
4 changes: 1 addition & 3 deletions .github/workflows/unit_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ jobs:
run: python -m pip install --upgrade pip
- name: Install dependencies
run: |
NIGHTLY_VERSION=dev20241121
python -m pip install torch=="2.6.0.${NIGHTLY_VERSION}" torchvision=="0.20.0.${NIGHTLY_VERSION}" --extra-index-url https://download.pytorch.org/whl/nightly/cpu
python -m pip install torchao
python -m pip install torch torchvision torchao
python -m pip install -e ".[dev]"
- name: Run unit tests with coverage
run: pytest tests --cov=. --cov-report=xml --durations=20 -vv
Expand Down
11 changes: 11 additions & 0 deletions torchtune/modules/_export/install_requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

NIGHTLY_VERSION="dev20241121"

# Install pytorch nightly for export-friendly modules to run.
pip install torch==2.6.0.${NIGHTLY_VERSION} torchvision==0.20.0.${NIGHTLY_VERSION} --extra-index-url https://download.pytorch.org/whl/nightly/cpu

0 comments on commit 0c772b1

Please sign in to comment.