Merge pull request #285 from karpathy/feature/civ2

Upgrading CI to run our new pytest
This commit is contained in:
Andrej
2023-08-13 16:55:01 -07:00
committed by GitHub
2 changed files with 19 additions and 3 deletions
+17 -3
View File
@@ -4,10 +4,10 @@ on:
push: push:
branches: branches:
- master - master
paths: ['.github/workflows/**', '**/Makefile', '**/*.c', '**/*.h'] paths: ['.github/workflows/**', '**/Makefile', '**/*.c', '**/*.h', '**/*.py']
pull_request: pull_request:
types: [opened, synchronize, reopened] types: [opened, synchronize, reopened]
paths: ['**/Makefile', '**/*.c', '**/*.h'] paths: ['**/Makefile', '**/*.c', '**/*.h', '**/*.py']
# for manual triggering # for manual triggering
workflow_dispatch: workflow_dispatch:
@@ -17,7 +17,7 @@ env:
jobs: jobs:
# check basic builds to avoid breaking changes # check basic builds to avoid breaking changes
ubuntu-focal-make: ubuntu-focal-make:
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
steps: steps:
- name: Clone - name: Clone
@@ -30,6 +30,16 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install build-essential -y sudo apt-get install build-essential -y
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Pip setup
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build - name: Build
id: make_build id: make_build
run: | run: |
@@ -40,6 +50,10 @@ jobs:
run: | run: |
make runfast make runfast
- name: Test with pytest
run: |
pytest
macOS-latest-make: macOS-latest-make:
runs-on: macos-latest runs-on: macos-latest
+2
View File
@@ -42,6 +42,7 @@ expected_stdout = b'Once upon a time, there was a little girl named Lily. She lo
def test_runc(): def test_runc():
""" Forwards a model against a known-good desired outcome in run.c for 200 steps""" """ Forwards a model against a known-good desired outcome in run.c for 200 steps"""
attempt_download_files()
model_path = os.path.join(test_ckpt_dir, "stories260K.bin") model_path = os.path.join(test_ckpt_dir, "stories260K.bin")
tokenizer_path = os.path.join(test_ckpt_dir, "tok512.bin") tokenizer_path = os.path.join(test_ckpt_dir, "tok512.bin")
@@ -56,6 +57,7 @@ def test_runc():
def test_python(): def test_python():
""" Forwards a model against a known-good desired outcome in sample.py for 200 steps""" """ Forwards a model against a known-good desired outcome in sample.py for 200 steps"""
attempt_download_files()
device = "cpu" # stories260K is small enough to just breeze through it on CPU device = "cpu" # stories260K is small enough to just breeze through it on CPU
checkpoint = os.path.join(test_ckpt_dir, "stories260K.pt") checkpoint = os.path.join(test_ckpt_dir, "stories260K.pt")