Heavily improve automatic model card generation + Patch XLM-R #211
Workflow file for this run
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: Unit tests | |
on: | |
push: | |
branches: | |
- main | |
- v*-release | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test_sampling: | |
name: Run unit tests | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
os: [ubuntu-latest, windows-latest] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Python environment | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Try to load cached dependencies | |
uses: actions/cache@v3 | |
id: restore-cache | |
with: | |
path: ${{ env.pythonLocation }} | |
key: python-dependencies-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ env.pythonLocation }} | |
- name: Install external dependencies on cache miss | |
run: | | |
python -m pip install --no-cache-dir --upgrade pip | |
python -m pip install --no-cache-dir ".[dev, codecarbon]" | |
python -m spacy download en_core_web_sm | |
if: steps.restore-cache.outputs.cache-hit != 'true' | |
- name: Install the checked-out span_marker | |
run: python -m pip install . | |
- name: Restore HF models from cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cache/huggingface/hub | |
~/.cache/torch | |
key: hf-models-${{ matrix.os }}-${{ env.NEW_HF_CACHE_HASH }} | |
restore-keys: | | |
hf-models-${{ matrix.os }}- | |
- name: Run unit tests | |
shell: bash | |
run: | | |
echo "OLD_HF_CACHE_HASH=$(find ~/.cache/huggingface/hub -type f -exec sha256sum {} + | LC_ALL=C sort | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_ENV | |
pytest -sv | |
echo "NEW_HF_CACHE_HASH=$(find ~/.cache/huggingface/hub -type f -exec sha256sum {} + | LC_ALL=C sort | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_ENV | |
- name: Save new HF models to cache | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
~/.cache/huggingface/hub | |
~/.cache/torch | |
key: hf-models-${{ matrix.os }}-${{ env.NEW_HF_CACHE_HASH }} | |
# Only save cache if the hash has changed | |
if: env.NEW_HF_CACHE_HASH != env.OLD_HF_CACHE_HASH |