-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from berenslab/feat-ci-pipeline
Feat CI Pipeline
- Loading branch information
Showing
13 changed files
with
247 additions
and
85 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,48 @@ | ||
name: Code Checking | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**/*.py' | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: | ||
singularity_image: oras://ghcr.io/berenslab/retinal-rl:singularity-image-latest | ||
sif_file: retinal-rl_singularity-image-latest.sif | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Fetch all branches | ||
run: git fetch --all | ||
|
||
- name: Setup Apptainer | ||
uses: eWaterCycle/setup-apptainer@v2 | ||
with: | ||
apptainer-version: 1.3.0 | ||
- name: Cache Singularity Image | ||
id: cache-singularity | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.sif_file }} | ||
key: ${{ runner.os }}-singularity-${{ hashFiles('~/resources/retinal-rl.def') }} | ||
restore-keys: | | ||
${{ runner.os }}-singularity-${{ hashFiles('~/resources/retinal-rl.def') }} | ||
${{ runner.os }}-singularity- | ||
- name: Pull Singularity container | ||
if: steps.cache-singularity.outputs.cache-hit != 'true' | ||
run: | | ||
singularity registry login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} oras://ghcr.io | ||
singularity pull ${{ env.sif_file }} ${{ env.singularity_image }} | ||
- name: Run Pylint | ||
run: | | ||
singularity exec ${{ env.sif_file }} \ | ||
pylint $(git diff --name-only origin/master...HEAD -- '*.py') |
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,36 @@ | ||
name: Scan Configs | ||
on: [pull_request,workflow_dispatch] | ||
|
||
env: | ||
singularity_image: oras://ghcr.io/berenslab/retinal-rl:singularity-image-latest | ||
sif_file: retinal-rl_singularity-image-latest.sif | ||
|
||
jobs: | ||
scan: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Apptainer | ||
uses: eWaterCycle/setup-apptainer@v2 | ||
with: | ||
apptainer-version: 1.3.0 | ||
- name: Cache Singularity Image | ||
id: cache-singularity | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.sif_file }} | ||
key: ${{ runner.os }}-singularity-${{ hashFiles('~/resources/retinal-rl.def') }} | ||
restore-keys: | | ||
${{ runner.os }}-singularity-${{ hashFiles('~/resources/retinal-rl.def') }} | ||
${{ runner.os }}-singularity- | ||
- name: Pull Singularity container | ||
if: steps.cache-singularity.outputs.cache-hit != 'true' | ||
run: | | ||
singularity registry login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} oras://ghcr.io | ||
singularity pull ${{ env.sif_file }} ${{ env.singularity_image }} | ||
- name: Scan classification config | ||
run: | | ||
cp -r resources/config_templates/* config/ | ||
singularity exec ${{ env.sif_file }} \ | ||
python main.py -m +experiment=cifar10-class-recon command=scan system.device=cpu |
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,35 @@ | ||
name: Build Singularity Container | ||
|
||
on: | ||
schedule: | ||
- cron: '0 2 1 * *' | ||
push: | ||
paths: | ||
- 'resources/retinal-rl.def' | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- 'resources/retinal-rl.def' | ||
|
||
jobs: | ||
singularity-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: eWaterCycle/setup-apptainer@v2 | ||
with: | ||
apptainer-version: 1.3.0 | ||
|
||
- name: Build Singularity container | ||
run: apptainer build retinal-rl.sif resources/retinal-rl.def | ||
|
||
- name: Scan classification config / ensure minimal functionality | ||
run: | | ||
cp -r resources/config_templates/* config/ | ||
singularity exec retinal-rl.sif python main.py -m +experiment=cifar10-class-recon command=scan system.device=cpu | ||
- name: Push to ghcr.io | ||
run: | | ||
singularity registry login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} oras://ghcr.io | ||
singularity push retinal-rl.sif oras://ghcr.io/berenslab/retinal-rl:singularity-image-latest |
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,2 @@ | ||
[MASTER] | ||
init-hook='import sys; sys.path.append(".")' |
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 +1,8 @@ | ||
"""Templates for doom scenario creation | ||
This module provides the templates for acs scripts, decorate | ||
definitions and the overall config (vizdoom) | ||
""" | ||
from doom_creator.util._templates import acs, decorate, vizdoom | ||
|
||
__all__ = ['acs', 'decorate', 'vizdoom'] |
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
29 changes: 13 additions & 16 deletions
29
resources/config_templates/user/experiment/cifar10-class-recon.yaml
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,25 +1,22 @@ | ||
# This is the main entry point for users to specify their config parameters, and | ||
# should be freely copied and edited. | ||
|
||
# Defaults for the various subconfigs. Can be overriden from the commandline | ||
# with e.g. experiment/brain=new_brain, where new_brain.yaml lives in the brain | ||
# subdirectory | ||
# @package _global_ | ||
defaults: | ||
- _self_ | ||
- sweep: kernel-size | ||
- dataset: cifar10-large | ||
- brain: retinal-classifier | ||
- optimizer: class-recon | ||
- override /dataset: cifar10-decontrast | ||
- override /brain: shallow-autoencoder | ||
- override /optimizer: recon-weight | ||
|
||
# This *must* match the experiment file name | ||
name: cifar10-class-recon | ||
# This is the main entry point for control of a retinal-rl experiment. Variables | ||
# created here will be top-level, and defaults can be set for the various parts | ||
# of an experiment (NB: do not add comments above the defaults list or it will | ||
# break the config system.) | ||
framework: classification | ||
|
||
# This is a free list of parameters that can be interpolated by the subconfigs | ||
# in sweep, dataset, brain, and optimizer. A major use for this is interpolating | ||
# values in the subconfigs, and then looping over them in a sweep. | ||
latent_size: 128 | ||
hidden_units: 64 | ||
activation: "elu" | ||
kernel_size: 8 | ||
stride: 2 | ||
activation_sparsity: 0.0001 | ||
weight_decay: 0.0001 | ||
sparse_objective: retinal_rl.models.objective.L1Sparsity | ||
recon_weight_retina: 1 | ||
recon_weight_thalamus: 0.99 |
46 changes: 0 additions & 46 deletions
46
resources/config_templates/user/optimizer/class-recon.yaml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.