Skip to content

Finish initial impl of torch optimizer #10

Finish initial impl of torch optimizer

Finish initial impl of torch optimizer #10

Workflow file for this run

name: tests
on:
push:
paths-ignore:
- "website/**"
- "*.md"
pull_request:
types: [opened, synchronize, reopened, edited]
paths-ignore:
- "website/**"
- "*.md"
jobs:
tests:
name: Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python_version: ["3.11"]
include:
- os: windows-2019
python_version: "3.6"
- os: macos-latest
python_version: "3.7"
- os: ubuntu-latest
python_version: "3.8"
- os: windows-latest
python_version: "3.9"
- os: macos-latest
python_version: "3.10"
runs-on: ${{ matrix.os }}
env:
NOTEBOOK_KERNEL: "thinc-notebook-tests"
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Configure Python version
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
architecture: x64
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
- name: Build sdist
run: |
python setup.py build_ext --inplace
python setup.py sdist --formats=gztar
- name: Run mypy
run: python -m mypy thinc --no-implicit-reexport
if: matrix.python_version != '3.6'
- name: Delete source directory
run: rm -rf thinc
shell: bash
- name: Uninstall all packages
run: |
python -m pip freeze
pip freeze --exclude pywin32 > installed.txt
pip uninstall -y -r installed.txt
- name: Install from sdist
run: |
SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1)
PIP_CONSTRAINT="build-constraints.txt" pip install dist/$SDIST
shell: bash
- name: Test import
run: python -c "import thinc"
- name: Run tests without extras
run: |
pip install -r requirements.txt
pip install ipykernel pydot graphviz
python -m ipykernel install --name thinc-notebook-tests --user
python -m pytest --pyargs thinc --cov=thinc --cov-report=term
# Notes on numpy requirements hacks:
# 1. torch does not have a direct numpy requirement but is compiled
# against a newer version than the oldest supported numpy for windows and
# python 3.10; this version of numpy would not work with
# tensorflow~=2.5.0 as specified above, but there is no release for
# python 3.10 anyway
# 2. restrict to numpy<1.24.0 due to mxnet incompatibility
# 3. forbid torch!=1.13.0 due to segfaults with numpy<1.24.0
# Note: some of these pip install commands are known to fail for some platforms.
# To continue despite errors as in azure pipelines, remove -e from the default
# bash flags.
- name: Install extras for testing
run: |
pip install "protobuf~=3.20.0" "tensorflow~=2.5.0"
pip install "mxnet; sys_platform != 'win32'"
pip install "torch!=1.13.0" --extra-index-url https://download.pytorch.org/whl/cpu
pip install "numpy~=1.23.0; python_version=='3.10' and sys_platform=='win32'"
pip install "numpy<1.24.0"
pip install -r requirements.txt
pip uninstall -y mypy
shell: bash --noprofile --norc -o pipefail {0}
- name: Run tests with extras
run: python -m pytest --pyargs thinc --cov=thinc --cov-report=term
- name: Run tests for thinc-apple-ops
run: |
pip uninstall -y tensorflow
pip install thinc-apple-ops
python -m pytest --pyargs thinc_apple_ops
if: matrix.os == 'macos-latest' && matrix.python_version == '3.10'
- name: Run tests with thinc-apple-ops
run: python -m pytest --pyargs thinc
if: matrix.os == 'macos-latest' && matrix.python_version == '3.10'