-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/develop'
- Loading branch information
Showing
94 changed files
with
5,074 additions
and
3,988 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,29 @@ | ||
name: GitHub Actions Demo | ||
on: [push, pull_request] | ||
jobs: | ||
Github-Actions-CI: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
- run: | | ||
echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Add conda to system path | ||
run: | | ||
# $CONDA is an environment variable pointing to the root of the miniconda directory | ||
echo $CONDA/bin >> $GITHUB_PATH | ||
- name: Install dependencies | ||
run: | | ||
conda env create --file environment.yml | ||
- name: test GDL's 3 major modes | ||
run: | | ||
source /usr/share/miniconda/etc/profile.d/conda.sh | ||
conda activate geo_deep_env | ||
unzip ./data/massachusetts_buildings.zip -d ./data | ||
python GDL.py mode=sampling | ||
python GDL.py mode=train | ||
python GDL.py mode=inference |
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
FROM continuumio/miniconda3 | ||
|
||
WORKDIR /app | ||
|
||
# Create the environment: | ||
COPY environment.yml . | ||
RUN conda env create -f environment.yml | ||
|
||
# Make RUN commands use the new environment: | ||
SHELL ["conda", "run", "-n", "geo_deep_env", "/bin/bash", "-c"] | ||
|
||
# Make sure the environment is activated: | ||
RUN echo "Make sure flask is installed:" | ||
RUN python -c "import flask" | ||
|
||
# The code to run when container is started: | ||
#COPY run.py . | ||
ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "geo_deep_env", "python"] |
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,80 @@ | ||
import os | ||
import time | ||
import hydra | ||
import logging | ||
from omegaconf import DictConfig, OmegaConf, open_dict | ||
from utils.utils import load_obj, print_config, get_git_hash, getpath | ||
|
||
|
||
@hydra.main(config_path="config", config_name="gdl_config_template") | ||
def run_gdl(cfg: DictConfig) -> None: | ||
""" | ||
Function general for Geo Deep-Learning using Hydra library to rules all the | ||
parameters and functions using during the task wanted to execute. | ||
Process | ||
------- | ||
1. Read and convert the `gdl_config.yaml` to a dictionary. | ||
2. Verify if the code and other information need to be save. | ||
3. If the debug option is activate, the entire config yaml will be printed | ||
and save in a log. In addition of that, if the mode is `train`, a | ||
validation run will precede the training to assure the well functioning | ||
of the code. | ||
4. Verify is the chosen mode is available. | ||
5. Verify is the chosen task is available and run the code link to that | ||
task. | ||
------- | ||
:param cfg: (DictConfig) Parameters and functions in the main yaml config | ||
file. | ||
""" | ||
cfg = OmegaConf.create(cfg) | ||
|
||
# debug config | ||
if cfg.debug: | ||
pass | ||
# cfg.training.num_sanity_val_steps = 1 # only work with pytorch lightning | ||
# logging.info(OmegaConf.to_yaml(cfg, resolve=True)) | ||
|
||
# check if the mode is chosen | ||
if type(cfg.mode) is DictConfig: | ||
msg = "You need to choose between those modes: {}" | ||
raise logging.critical(msg.format(list(cfg.mode.keys()))) | ||
|
||
# save all overwritten parameters | ||
logging.info('\nOverwritten parameters in the config: \n' + cfg.general.config_override_dirname) | ||
|
||
# Start ----------------------------------- | ||
msg = "Let's start {} for {} !!!".format(cfg.mode, cfg.task.task_name) | ||
logging.info( | ||
"\n" + "-" * len(msg) + "\n" + msg + | ||
"\n" + "-" * len(msg) | ||
) | ||
# ----------------------------------------- | ||
|
||
# Start the timer | ||
start_time = time.time() | ||
# Read the task and execute it | ||
task = load_obj(cfg.task.path_task_function) | ||
task(cfg) | ||
|
||
# Add git hash from current commit to parameters. | ||
with open_dict(cfg): | ||
cfg.general.git_hash = get_git_hash() | ||
|
||
# Pretty print config using Rich library | ||
if cfg.get("print_config"): | ||
print_config(cfg, resolve=True) | ||
|
||
# End -------------------------------- | ||
msg = "End of {} !!!".format(cfg.mode) | ||
logging.info( | ||
"\n" + "-" * len(msg) + "\n" + msg + "\n" + | ||
"Elapsed time: {:.2f}s".format(time.time() - start_time) + | ||
"\n" + "-" * len(msg) + "\n" | ||
) | ||
# ------------------------------------ | ||
|
||
|
||
if __name__ == '__main__': | ||
run_gdl() |
Oops, something went wrong.