mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-10-29 17:01:30 +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": [
|
||||
"# NBVAL_SKIP\n",
|
||||
"from importlib.metadata import version\n",
|
||||
"\n",
|
||||
"print(\"torch version:\", version(\"torch\"))\n",
|
||||
@ -188,7 +189,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.4"
|
||||
"version": "3.10.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user