-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update geo-inference parameters (#579)
* update parameters from geo-inference * update inference doc * update base docker image, reduce size * update dependencies * update extrac param from torchgeo * tests correction for torchego extract * refactor imports, pep8 compliant * add TTA support from geo-inference * script_model fix for TTA --------- Co-authored-by: Turgeon-Pelchat <mathieu.turgeon-pelchat@nrcan-rncan.gc.ca>
- Loading branch information
1 parent
fc633ee
commit b0a2b73
Showing
17 changed files
with
182 additions
and
171 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,8 @@ | ||
tests | ||
.github | ||
.git | ||
.pytest_cache | ||
.vscode | ||
__pycache__ | ||
*.md | ||
docs/* |
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,46 +1,38 @@ | ||
FROM nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04 | ||
FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04 | ||
|
||
ARG CONDA_PYTHON_VERSION=3 | ||
ARG CONDA_DIR=/opt/conda | ||
ARG USERNAME=gdl_user | ||
ARG USERID=1000 | ||
ARG GIT_TAG=develop | ||
|
||
ENV PATH=$CONDA_DIR/bin:$PATH | ||
# RNCAN certificate; uncomment (with right .cer name) if you are building behind a FW | ||
#COPY NRCan-RootCA.cer /usr/local/share/ca-certificates/cert.crt | ||
#RUN chmod 644 /usr/local/share/ca-certificates/cert.crt && update-ca-certificates | ||
# COPY NRCan-RootCA.cer /usr/local/share/ca-certificates/cert.crt | ||
# RUN chmod 644 /usr/local/share/ca-certificates/cert.crt && update-ca-certificates | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends git wget unzip bzip2 build-essential sudo \ | ||
&& apt-key del 7fa2af80 \ | ||
&& wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb \ | ||
&& sudo dpkg -i cuda-keyring_1.0-1_all.deb \ | ||
&& wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004-keyring.gpg \ | ||
&& sudo mv cuda-ubuntu2004-keyring.gpg /usr/share/keyrings/cuda-archive-keyring.gpg \ | ||
&& rm -f cuda-keyring_1.0-1_all.deb && rm -f /etc/apt/sources.list.d/cuda.list | ||
|
||
# Install Mamba directly | ||
ENV PATH $CONDA_DIR/bin:$PATH | ||
RUN wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O /tmp/mamba.sh && \ | ||
/bin/bash /tmp/mamba.sh -b -p $CONDA_DIR && \ | ||
rm -rf /tmp/* && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
ENV LD_LIBRARY_PATH $CONDA_DIR/lib:$LD_LIBRARY_PATH | ||
|
||
# Create the user | ||
RUN useradd --create-home -s /bin/bash --no-user-group -u $USERID $USERNAME && \ | ||
chown $USERNAME $CONDA_DIR -R && \ | ||
adduser $USERNAME sudo && \ | ||
echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
|
||
&& wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O /tmp/mamba.sh \ | ||
&& /bin/bash /tmp/mamba.sh -b -p $CONDA_DIR \ | ||
&& rm -rf /tmp/* \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& useradd --create-home -s /bin/bash --no-user-group -u $USERID $USERNAME \ | ||
&& chown $USERNAME $CONDA_DIR -R \ | ||
&& adduser $USERNAME sudo \ | ||
&& echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
|
||
ENV LD_LIBRARY_PATH=$CONDA_DIR/lib:$LD_LIBRARY_PATH | ||
USER $USERNAME | ||
WORKDIR /home/$USERNAME/ | ||
|
||
RUN cd /home/$USERNAME && git clone --depth 1 "https://github.com/NRCan/geo-deep-learning.git" --branch $GIT_TAG | ||
RUN conda config --set ssl_verify no | ||
RUN mamba env create -f /home/$USERNAME/geo-deep-learning/environment.yml | ||
|
||
ENV PATH $CONDA_DIR/envs/geo_deep_env/bin:$PATH | ||
RUN echo "source activate geo_deep_env" > ~/.bashrc | ||
WORKDIR /usr/app | ||
|
||
COPY environment.yml /usr/app | ||
RUN cd /home/$USERNAME && \ | ||
conda config --set ssl_verify no && \ | ||
mamba env create -f /usr/app/environment.yml && \ | ||
mamba clean --all \ | ||
&& pip uninstall -y pip | ||
|
||
COPY . /usr/app/geo-deep-learning | ||
ENV PATH=$CONDA_DIR/envs/geo_ml_env/bin:$PATH | ||
RUN echo "source activate geo_ml_env" > ~/.bashrc |
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,16 +1,27 @@ | ||
name: geo_deep_env | ||
name: geo_ml_env | ||
channels: | ||
- pytorch | ||
- nvidia | ||
- conda-forge | ||
dependencies: | ||
- python==3.11.5 | ||
- coverage>=6.3.1 | ||
- geopandas>=0.14.4 | ||
- hydra-core>=1.2.0 | ||
- pip | ||
- gdal | ||
- pystac>=0.3.0 | ||
- pynvml>=11.0 | ||
- pystac>=1.10.1 | ||
- pytest>=7.1 | ||
- python>=3.11 | ||
- pytorch>=2.3 | ||
- pytorch-cuda>=12.1 | ||
- rich>=11.1 | ||
- ruamel_yaml>=0.15 | ||
- scikit-image>=0.18 | ||
- torchgeo>=0.5.2 | ||
- torchvision>=0.13 | ||
- pip: | ||
- geo-inference>=2.0.7 | ||
- git+https://github.com/NRCan/geo-inference.git | ||
- hydra-colorlog>=1.1.0 | ||
- hydra-optuna-sweeper>=1.1.0 | ||
- ttach>=0.0.3 | ||
- mlflow>=1.2 # causes env solving to hang if not with pip |
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.