mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-10-30 01:10:33 +00:00
Test with PyTorch 2.0 and 2.4 (#290)
* Test with PyTorch 2.0 and 2.4 * Update basic-tests-old-pytorch.yml * skip version cell
This commit is contained in:
parent
7bf0d13ee8
commit
f66c089f0b
54
.github/workflows/basic-tests-old-pytorch.yml
vendored
Normal file
54
.github/workflows/basic-tests-old-pytorch.yml
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
name: Test PyTorch 2.0 and 2.4
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
paths:
|
||||||
|
- '**/*.py' # Run workflow for changes in Python files
|
||||||
|
- '**/*.ipynb'
|
||||||
|
- '**/*.yaml'
|
||||||
|
- '**/*.yml'
|
||||||
|
- '**/*.sh'
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
paths:
|
||||||
|
- '**/*.py'
|
||||||
|
- '**/*.ipynb'
|
||||||
|
- '**/*.yaml'
|
||||||
|
- '**/*.yml'
|
||||||
|
- '**/*.sh'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
pytorch-version: [ 2.0.1, 2.4.0 ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.10"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install pytest nbval
|
||||||
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||||
|
pip install torch==${{ matrix.pytorch-version }}
|
||||||
|
|
||||||
|
- name: Test Selected Python Scripts
|
||||||
|
run: |
|
||||||
|
pytest setup/02_installing-python-libraries/tests.py
|
||||||
|
pytest ch04/01_main-chapter-code/tests.py
|
||||||
|
pytest ch05/01_main-chapter-code/tests.py
|
||||||
|
pytest ch06/01_main-chapter-code/tests.py
|
||||||
|
|
||||||
|
- name: Validate Selected Jupyter Notebooks
|
||||||
|
run: |
|
||||||
|
pytest --nbval ch02/01_main-chapter-code/dataloader.ipynb
|
||||||
|
pytest --nbval ch03/01_main-chapter-code/multihead-attention.ipynb
|
||||||
|
pytest --nbval ch02/04_bonus_dataloader-intuition/dataloader-intuition.ipynb
|
||||||
@ -62,6 +62,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
|
"# NBVAL_SKIP\n",
|
||||||
"from importlib.metadata import version\n",
|
"from importlib.metadata import version\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print(\"torch version:\", version(\"torch\"))\n",
|
"print(\"torch version:\", version(\"torch\"))\n",
|
||||||
@ -188,7 +189,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.11.4"
|
"version": "3.10.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user