Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Training test migration #1002

Merged
merged 33 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e47ef17
hello world
prishavall Oct 1, 2023
6859978
old changes new branch
prishavall Oct 1, 2023
9910b26
update ubuntu
prishavall Oct 1, 2023
aad5576
poetry lock
prishavall Oct 1, 2023
68adebf
:art: Format Python code with psf/black
prishavall Oct 1, 2023
49c78d1
tmate debug
karkir0003 Oct 7, 2023
a2a08e4
miniforge shell alt action
karkir0003 Oct 7, 2023
a3196ad
indent
karkir0003 Oct 7, 2023
c433701
mamba miniforge3 shell
karkir0003 Oct 7, 2023
234dfff
test job update
karkir0003 Oct 7, 2023
4df8afe
cache support for miniforge env
karkir0003 Oct 7, 2023
c5f54ed
fix env
karkir0003 Oct 7, 2023
8b88ac8
path fix
karkir0003 Oct 7, 2023
d572d68
cache fix
karkir0003 Oct 7, 2023
62718f3
CACHE_NUMBER to reset cache
karkir0003 Oct 7, 2023
7ea84e8
restore keys keys hint removed
karkir0003 Oct 7, 2023
c8cc0f9
cache number
karkir0003 Oct 7, 2023
5ddc933
bump cache number
karkir0003 Oct 7, 2023
0d00db8
poetry run append
karkir0003 Oct 7, 2023
fb8a8d8
no cleanup
karkir0003 Oct 7, 2023
0c2538b
typo
karkir0003 Oct 7, 2023
a93915a
remove --list in conda env command
karkir0003 Oct 7, 2023
d65d66c
adjust shell name
karkir0003 Oct 7, 2023
8ac002e
poetry cache number
karkir0003 Oct 7, 2023
33ada0c
bump cache number
karkir0003 Oct 7, 2023
3f04e2b
backend.yml fix
karkir0003 Oct 7, 2023
9207ac4
clean up commented out code in backend.yml
karkir0003 Oct 7, 2023
b6b7ef2
remove unused code
karkir0003 Oct 7, 2023
1c12b7c
cache implemented
karkir0003 Oct 7, 2023
4a10a1a
poetry to path + remove legacy lib arg
karkir0003 Oct 8, 2023
53af8a4
new changes
prishavall Oct 14, 2023
a9e9e4f
code cleanup commit
prishavall Oct 14, 2023
f256911
removed line
prishavall Oct 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 61 additions & 23 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,37 @@ on:

jobs:
lint:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up mamba env
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3

- uses: mamba-org/setup-micromamba@v1

- name: Setup Mamba
uses: conda-incubator/setup-miniconda@v2
with:
micromamba-version: '1.4.5-0'
environment-file: training/environment.yml
init-shell: >-
bash
cache-environment: true
cache-environment-key: mamba-env-${{ runner.os }}-${{ hashFiles('**/training/environment.yml') }}
miniforge-version: latest
use-mamba: true
activate-environment: dlp

- name: Cache Mamba env
id: cached-mamba-env
uses: actions/cache@v3
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: /usr/share/miniconda3/envs/
key:
mamba-${{ runner.os }}-${{env.CACHE_NUMBER }}-${{hashFiles('**/training/environment.yml') }}

- name: Update environment
run:
mamba env update -n dlp -f
training/environment.yml
if: steps.cached-mamba-env.outputs.cache-hit != 'true'

#----------------------------------------------
# load cached venv if cache exists
Expand All @@ -36,7 +51,7 @@ jobs:
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: /home/runner/micromamba/envs/dlp/
path: /usr/share/miniconda3/envs/dlp
key: training-venv-${{ runner.os }}-${{ hashFiles('**/training/poetry.lock') }}
restore-keys: training-venv-${{ runner.os }}-

Expand All @@ -47,8 +62,11 @@ jobs:
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: pwd && cd training && poetry install --no-interaction --no-root && poetry env info -p
shell: micromamba-shell {0}
shell: bash -el {0}

- name: Add Poetry env to PATH
run: cd training && echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
shell: bash -el {0}
#----------------------------------------------
# pyright static checker
#----------------------------------------------
Expand All @@ -58,7 +76,6 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }} # You need this
reporter: github-pr-review # Change reporter.
lib: true

#----------------------------------------------
# black formatter
Expand All @@ -85,33 +102,54 @@ jobs:
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3

- name: Setup Mamba
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
use-mamba: true
activate-environment: dlp

- uses: mamba-org/setup-micromamba@v1
- name: Cache Mamba env
id: cached-mamba-env
uses: actions/cache@v3
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
micromamba-version: '1.4.5-0'
environment-file: training/environment.yml
init-shell: >-
bash
cache-environment: true
cache-environment-key: mamba-env-${{ runner.os }}-${{ hashFiles('**/training/environment.yml') }}
path: /usr/share/miniconda3/envs/
key:
mamba-${{ runner.os }}-${{env.CACHE_NUMBER }}-${{hashFiles('**/training/environment.yml') }}

- name: Update environment
run:
mamba env update -n dlp -f
training/environment.yml
if: steps.cached-mamba-env.outputs.cache-hit != 'true'

#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: /home/runner/micromamba/envs/dlp/
path: /usr/share/miniconda3/envs/dlp
key: training-venv-${{ runner.os }}-${{ hashFiles('**/training/poetry.lock') }}
restore-keys: training-venv-${{ runner.os }}-

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: cd training && poetry install --no-interaction --no-root
shell: micromamba-shell {0}
shell: bash -el {0}

- name: Add Poetry env to PATH
run: cd training && echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
shell: bash -el {0}
#----------------------------------------------
# run test suite
#----------------------------------------------
Expand All @@ -120,6 +158,6 @@ jobs:
export AWS_ACCESS_KEY_ID=testing
export AWS_SECRET_ACCESS_KEY=testing
export AWS_DEFAULT_REGION=us-west-2
# cd training && pytest tests
shell: micromamba-shell {0}
cd training && poetry run pytest tests
shell: bash -el {0}

13 changes: 0 additions & 13 deletions backend/tests/test_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest
import torch.nn as nn
from torch.autograd import Variable
from dl.dl_model import *


Expand All @@ -13,19 +12,7 @@
],
)
def test_dlmodel(input_list):
print("input_list: " + str(input_list) + " is of type " + str(type(input_list)))
my_model = DLModel(input_list)
print("my_model: " + str(my_model) + " is of type " + str(type(my_model)))
print(
"[module for module in my_model.model.modules() if not isinstance(module, nn.Sequential)]: "
+ str(
[
module
for module in my_model.model.modules()
if not isinstance(module, nn.Sequential)
]
)
)
assert [
module
for module in my_model.model.modules()
Expand Down
6 changes: 0 additions & 6 deletions backend/tests/test_model_parser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest
import torch.nn as nn
from torch.autograd import Variable
from dl.dl_model_parser import *

# come up with the expected parsing
Expand All @@ -27,9 +26,4 @@
],
)
def test_parse_user_architecture(user_model, expected):
print(
"parse_user_architecture(user_model): "
+ str(parse_deep_user_architecture(user_model))
)
print("expected: " + str(expected))
assert [i == j for i, j in zip(parse_deep_user_architecture(user_model), expected)]
Loading
Loading