Skip to content

Commit

Permalink
ci: add examples workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dacorvo committed Apr 2, 2024
1 parent 04705e0 commit e905dc3
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/python-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Python examples (CPU)

on:
push:
branches:
- main
paths:
- "quanto/**"
- "examples/**"
- "pyproject.toml"
- "setup.py"
pull_request:
types: [assigned, opened, synchronize, reopened]
paths:
- "quanto/**"
- "examples/**"
- "pyproject.toml"
- "setup.py"

jobs:
build-ubuntu:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

# Install dependencies
- name: Configure and install dependencies
run: |
pip install --upgrade pip
pip install .[examples]
# Run examples
- name: Run MNIST examples
run: |
for w in int4 int8 float8; do \
for a in none int8 float8; do \
python examples/vision/image-classification/mnist/quantize_mnist_model.py \
--weights $w --activations $a; \
done; \
done
- name: Run text-classification examples
run: |
for w in int4 int8; do \
for a in none int8; do \
python examples/nlp/text-classification/sst2/quantize_sst2_model.py \
--weights $w --activations $a; \
done; \
done
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ homepage = 'https://github.com/huggingface/quanto'

[project.optional-dependencies]
dev = ['pytest', 'ruff', 'black']
examples = ['torchvision', 'transformers', 'datasets']

[tool.setuptools.dynamic]
version = {attr = "quanto.__version__"}
Expand Down

0 comments on commit e905dc3

Please sign in to comment.