-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
77 changed files
with
6,819 additions
and
4,449 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# .github/workflows/regression_tests.yml | ||
name: Regression Tests | ||
|
||
on: | ||
# pull_request: | ||
# branches: | ||
# - main | ||
|
||
jobs: | ||
regression_tests: | ||
name: regression_tests | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
fetch-depth: 0 # This ensures we can checkout main branch too | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
architecture: 'x64' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e ".[dev]" | ||
- name: Run benchmarks and compare to baseline | ||
if: github.event.pull_request.base.ref == 'main' | ||
run: | | ||
# Check if regression test results exist in main branch | ||
if [ -f 'git cat-file -e main:tests/regression_test_baselines.json' ]; then | ||
git checkout main tests/regression_test_baselines.json | ||
else | ||
echo "No regression test results found in main branch" | ||
fi | ||
pytest -m regression |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Run Tutorials | ||
on: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
build: | ||
name: Run Tutorials | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
architecture: 'x64' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e ".[dev]" | ||
- name: Modify notebook parameters | ||
run: | | ||
# Replace parameters to reduce exec time of 07_gradient_descent | ||
sed -i 's/batch_size = 4/batch_size = 1/' docs/tutorials/07_gradient_descent.ipynb | ||
sed -i 's/for epoch in range(10):/for epoch in range(1):/' docs/tutorials/07_gradient_descent.ipynb | ||
sed -i 's/inputs = jnp.asarray(np.random.rand(100, 2))/inputs = jnp.asarray(np.random.rand(3, 2))/' docs/tutorials/07_gradient_descent.ipynb | ||
sed -i 's/t_max = 5.0/t_max = 3.0/' docs/tutorials/07_gradient_descent.ipynb | ||
- name: Test notebooks | ||
run: | | ||
for notebook in docs/tutorials/*.ipynb; do | ||
echo "Testing $notebook" | ||
jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=600 "$notebook" | ||
done |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# .github/workflows/update_regression_tests.yml | ||
|
||
# for details on triggering a workflow from a comment, see: | ||
# https://dev.to/zirkelc/trigger-github-workflow-for-comment-on-pull-request-45l2 | ||
name: Update Regression Baseline | ||
|
||
on: | ||
issue_comment: # trigger from comment; event runs on the default branch | ||
types: [created] | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
update_regression_tests: | ||
name: update_regression_tests | ||
runs-on: ubuntu-20.04 | ||
# Trigger from a comment | ||
# if: github.event.issue.pull_request && contains(github.event.comment.body, '/update_baseline') | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
env: | ||
username: ${{ github.event.pull_request.user.login }} # ${{ github.actor }} | ||
|
||
steps: | ||
- name: Get PR branch | ||
uses: xt0rted/pull-request-comment-branch@v1 | ||
id: comment-branch | ||
|
||
- name: Checkout PR branch | ||
uses: actions/checkout@v3 | ||
with: | ||
# ref: ${{ steps.comment-branch.outputs.head_sha }} # using head_sha vs. head_ref makes this work for forks | ||
lfs: true | ||
fetch-depth: 0 # This ensures we can checkout main branch too | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
architecture: 'x64' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e ".[dev]" | ||
- name: Update baseline | ||
if: github.event.pull_request.base.ref == 'main' | ||
run: | | ||
git config --global user.name '$username' | ||
git config --global user.email '[email protected]' | ||
# Check if regression test results exist in main branch | ||
if [ -f 'git cat-file -e main:tests/regression_test_baselines.json' ]; then | ||
git checkout main tests/regression_test_baselines.json | ||
else | ||
echo "No regression test results found in main branch" | ||
fi | ||
NEW_BASELINE=1 pytest -m regression | ||
- name: Add Baseline update report to PR comment | ||
uses: actions/github-script@v7 | ||
if: github.event.pull_request.base.ref == 'main' # might need `always()` to work | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const fs = require('fs'); | ||
const TestReport = fs.readFileSync('tests/regression_test_report.txt', 'utf8'); | ||
await github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `## New Baselines \n\`\`\`\n${TestReport}\n\`\`\`` | ||
}); | ||
- name: Commit and push | ||
if: github.event.pull_request.base.ref == 'main' | ||
run: | | ||
git add -f tests/regression_test_baselines.json # since it's in .gitignore | ||
git commit -m "Update regression test baselines" | ||
git push origin HEAD:${{ github.head_ref }} | ||
# Needed when workflow is triggered from a comment | ||
# - name: Commit and push | ||
# if: github.event.pull_request.base.ref == 'main' | ||
# run: | | ||
# git add -f tests/regression_test_baselines.json # since it's in .gitignore | ||
# git commit -m "Update regression test baselines" | ||
# git push origin HEAD:${{ steps.comment-branch.outputs.head_sha }} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Connecting Cells | ||
=============================== | ||
|
||
.. automodule:: jaxley.connect.connect | ||
.. autofunction:: jaxley.connect.connect | ||
.. autofunction:: jaxley.connect.connectivity_matrix_connect | ||
.. autofunction:: jaxley.connect.fully_connect | ||
.. autofunction:: jaxley.connect.sparse_connect |
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
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
Oops, something went wrong.