Skip to content

add cache

add cache #4

name: DVC & train-my-model (cache)
on: [push]
jobs:
run:
runs-on: [ubuntu-latest]
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
pytorch-version: ["1.12.0"]
steps:
- uses: actions/checkout@v2
- uses: iterative/setup-cml@v1
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ matrix.os }}-py${{ matrix.python-version }}-pt${{ matrix.pytorch-version }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ matrix.os }}-py${{ matrix.python-version }}-pt${{ matrix.pytorch-version }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_tests.txt
- uses: iterative/setup-dvc@v1
- name: Get data
run: dvc pull
env:
GDRIVE_CREDENTIALS_DATA: ${{ secrets.GDRIVE_CREDENTIALS_DATA }}
- name: Train model
run: |
python cnn_mnist/train_cml.py # run training
- name: Write report
env:
# this authenticates that the right permissions are in place
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# send all information to report.md that will be reported to us when the workflow finish
cat classification_report.txt >> report.md
cml-publish confusion_matrix.png --md >> report.md
cml-send-comment report.md