-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add transfer learning - Add gradient accumulation - Build docker container on release action - GPU memory cleanup on memory errors
- Loading branch information
Showing
47 changed files
with
1,793 additions
and
594 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
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,84 @@ | ||
# When a new release is published, | ||
# upload image to Dockerhub. | ||
# | ||
# Requires the following repository secrets: | ||
# - DOCKER_IMAGE - Configured as a secret so it can be configured per fork. | ||
# - DOCKER_HUB_USERNAME | ||
# - DOCKER_HUB_ACCESS_TOKEN | ||
# - GITHUBPAT - The github account to use for downloading CRAN dependencies. | ||
# Needed to avoid "API rate limit exceeded" from github. | ||
name: Release Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
tags: | ||
- 'v*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
env: | ||
DOCKER_IMAGE: 'ohdsi/deep_plp' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# ------------------------------------ | ||
# The pattern for the following steps is specified | ||
# in OHDSI/WebAPI. | ||
|
||
# Add Docker labels and tags | ||
- name: Docker meta | ||
id: docker_meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.DOCKER_IMAGE }} | ||
tags: | | ||
type=semver,pattern={{version}} | ||
# Setup docker build environment | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Set build parameters | ||
id: build_params | ||
run: | | ||
echo "SHA8=${GITHUB_SHA::8}" >> $GITHUB_ENV | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./ | ||
cache-from: type=gha | ||
cache-to: type=gha, mode=max | ||
file: Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
secrets: | | ||
build_github_pat=${{ secrets.GH_TOKEN }} | ||
build-args: | | ||
GIT_BRANCH=${{ steps.docker_meta.outputs.version }} | ||
GIT_COMMIT_ID_ABBREV=${{ env.SHA8 }} | ||
tags: ${{ steps.docker_meta.outputs.tags }} | ||
# Use runtime labels from docker_meta as well as fixed labels | ||
labels: | | ||
${{ steps.docker_meta.outputs.labels }} | ||
maintainer=Egill A. Fridgeirsson <[email protected]> | ||
org.opencontainers.image.authors=Egill A. Fridgeirsson <[email protected]>, Henrik John <[email protected]> | ||
org.opencontainers.image.vendor=OHDSI | ||
org.opencontainers.image.licenses=Apache-2.0 | ||
- name: Inspect image | ||
run: | | ||
docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} | ||
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} |
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 |
---|---|---|
|
@@ -11,3 +11,6 @@ extras/ | |
.Renviron | ||
inst/python/__pycache__ | ||
.mypy_cache | ||
/doc/ | ||
/Meta/ | ||
*.pt |
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,8 +1,8 @@ | ||
Package: DeepPatientLevelPrediction | ||
Type: Package | ||
Title: Deep Learning For Patient Level Prediction Using Data In The OMOP Common Data Model | ||
Version: 2.0.3 | ||
Date: 22-12-2023 | ||
Version: 2.1.0 | ||
Date: 08-07-2024 | ||
Authors@R: c( | ||
person("Egill", "Fridgeirsson", email = "[email protected]", role = c("aut", "cre")), | ||
person("Jenna", "Reps", email = "[email protected]", role = c("aut")), | ||
|
@@ -20,38 +20,36 @@ Depends: | |
R (>= 4.0.0) | ||
Imports: | ||
dplyr, | ||
FeatureExtraction (>= 3.0.0), | ||
ParallelLogger (>= 2.0.0), | ||
PatientLevelPrediction (>= 6.3.2), | ||
rlang, | ||
withr, | ||
reticulate (>= 1.31) | ||
Suggests: | ||
devtools, | ||
Eunomia, | ||
knitr, | ||
markdown, | ||
plyr, | ||
rmarkdown, | ||
testthat, | ||
PRROC, | ||
FeatureExtraction (>= 3.0.0), | ||
ResultModelManager (>= 0.2.0), | ||
DatabaseConnector (>= 6.0.0), | ||
Andromeda | ||
Remotes: | ||
ohdsi/PatientLevelPrediction, | ||
ohdsi/FeatureExtraction, | ||
ohdsi/Eunomia, | ||
ohdsi/ResultModelManager | ||
RoxygenNote: 7.2.3 | ||
RoxygenNote: 7.3.1 | ||
Encoding: UTF-8 | ||
Config/testthat/edition: 3 | ||
Config/testthat/parallel: TRUE | ||
Config/reticulate: | ||
list( | ||
packages = list( | ||
list(package = "torch"), | ||
list(package = "polars"), | ||
list(package = "tqdm"), | ||
list(package = "connectorx"), | ||
list(package = "pyarrow") | ||
list(package = "pyarrow"), | ||
list(package = "pynvml") | ||
) | ||
) |
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,64 @@ | ||
FROM docker.io/rocker/r-ver:4.4.1 AS build | ||
|
||
RUN --mount=type=secret,id=build_github_pat export GITHUB_PAT=$(cat /run/secrets/build_github_pat) | ||
|
||
ARG GIT_BRANCH='main' | ||
ARG GIT_COMMIT_ID_ABBREV | ||
|
||
RUN apt-get -y update && apt-get install -y \ | ||
default-jre \ | ||
default-jdk \ | ||
libssl-dev \ | ||
python3-pip \ | ||
python3-dev \ | ||
--no-install-recommends \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN R CMD javareconf | ||
|
||
RUN install2.r -n -1 \ | ||
remotes \ | ||
CirceR \ | ||
Eunomia \ | ||
duckdb \ | ||
&& installGithub.r \ | ||
OHDSI/CohortGenerator \ | ||
OHDSI/ROhdsiWebApi \ | ||
OHDSI/ResultModelManager | ||
|
||
RUN Rscript -e "DatabaseConnector::downloadJdbcDrivers(dbms='all', pathToDriver='/database_drivers/')" | ||
ENV DATABASECONNECTOR_JAR_FOLDER=/database_drivers/ | ||
|
||
# install Python packages | ||
RUN pip3 install uv \ | ||
&& uv pip install --system --no-cache-dir \ | ||
connectorx \ | ||
polars \ | ||
pyarrow \ | ||
torch \ | ||
tqdm \ | ||
pynvml \ | ||
&& rm -rf /root/.cache/pip | ||
|
||
RUN Rscript -e "ref <- Sys.getenv('GIT_COMMIT_ID_ABBREV', unset = Sys.getenv('GIT_BRANCH')); remotes::install_github('ohdsi/DeepPatientLevelPrediction', ref=ref)" | ||
|
||
|
||
FROM docker.io/rocker/rstudio:4.4.1 | ||
# | ||
COPY --from=build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages | ||
COPY --from=build /database_drivers /database_drivers | ||
COPY --from=build /usr/local/lib/R/site-library /usr/local/lib/R/site-library | ||
COPY --from=build /usr/local/lib/R/library /usr/local/lib/R/library | ||
|
||
ENV RETICULATE_PYTHON=/usr/bin/python3 | ||
# runtime dependanceis | ||
RUN apt-get -y update && apt-get install -y \ | ||
default-jre \ | ||
default-jdk \ | ||
libssl3 \ | ||
python3-dev \ | ||
--no-install-recommends \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& R CMD javareconf | ||
|
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
Oops, something went wrong.