Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Fixes for development inside the docker container (#335)
Browse files Browse the repository at this point in the history
* Fix the mound command for the HRNet pretrained model in the docker readme

* Properly catch InvalidGitRepository exception

* make repo paths consistent with non-docker runs -- this way configs paths do not need to be changed

* Properly catch InvalidGitRepository exception in train.py
  • Loading branch information
yalaudah authored May 29, 2020
1 parent 194cf31 commit e1d9df7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86
wget --quiet https://github.com/microsoft/seismic-deeplearning/archive/master.zip -O master.zip && \
unzip master.zip && rm master.zip

RUN cd seismic-deeplearning-master && \
RUN mv seismic-deeplearning-master seismic-deeplearning && \
cd seismic-deeplearning && \
conda env create -n seismic-interpretation --file environment/anaconda/local/environment.yml && \
source activate seismic-interpretation && \
python -m ipykernel install --user --name seismic-interpretation && \
Expand All @@ -34,7 +35,7 @@ RUN cd seismic-deeplearning-master && \

# TODO: add back in later when Penobscot notebook is available
# Download Penobscot dataset:
# RUN cd seismic-deeplearning-master && \
# RUN cd seismic-deeplearning && \
# data_dir="/home/username/data/penobscot" && \
# mkdir -p "$data_dir" && \
# ./scripts/download_penobscot.sh "$data_dir" && \
Expand All @@ -44,7 +45,7 @@ RUN cd seismic-deeplearning-master && \
# cd ..

# Download F3 dataset:
RUN cd seismic-deeplearning-master && \
RUN cd seismic-deeplearning && \
data_dir="/home/username/data/dutch" && \
mkdir -p "$data_dir" && \
./scripts/download_dutch_f3.sh "$data_dir" && \
Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This process will take a few minutes to complete.
# Run the Docker image:
Once the Docker image is built, you can run it anytime using the following command:
```bash
sudo docker run --rm -it -p 9000:9000 -p 9001:9001 --gpus=all --shm-size 11G --mount type=bind,source=$PWD/hrnetv2_w48_imagenet_pretrained.pth,target=/home/models/hrnetv2_w48_imagenet_pretrained.pth seismic-deeplearning
sudo docker run --rm -it -p 9000:9000 -p 9001:9001 --gpus=all --shm-size 11G --mount type=bind,source=$PWD/hrnetv2_w48_imagenet_pretrained.pth,target=/home/username/seismic-deeplearning/docker/hrnetv2_w48_imagenet_pretrained.pth seismic-deeplearning
```
If you have saved the pretrained model in a different directory, make sure you replace `$PWD/hrnetv2_w48_imagenet_pretrained.pth` with the **absolute** path to the pretrained HRNet model. The command above will run a Jupyter Lab instance that you can access by clicking on the link in your terminal. You can then navigate to the notebook or script that you would like to run.

Expand Down
3 changes: 2 additions & 1 deletion experiments/interpretation/dutchf3_patch/local/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def _patch_label_2d(
output = output_p[:, :, ps:-ps, ps:-ps]
return output


def _evaluate_split(
split, section_aug, model, pre_processing, output_processing, device, running_metrics_overall, config, debug=False,
):
Expand Down Expand Up @@ -273,7 +274,7 @@ def _evaluate_split(
output_dir = generate_path(
f"debug/{config.OUTPUT_DIR}_test_{split}", git_branch(), git_hash(), config.MODEL.NAME, current_datetime(),
)
except TypeError:
except:
output_dir = generate_path(f"debug/{config.OUTPUT_DIR}_test_{split}", config.MODEL.NAME, current_datetime(),)

running_metrics_split = runningScore(n_classes)
Expand Down
2 changes: 1 addition & 1 deletion experiments/interpretation/dutchf3_patch/local/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def run(*options, cfg=None, debug=False):
output_dir = generate_path(
config.OUTPUT_DIR, git_branch(), git_hash(), config_file_name, config.TRAIN.MODEL_DIR, current_datetime(),
)
except TypeError:
except:
output_dir = generate_path(config.OUTPUT_DIR, config_file_name, config.TRAIN.MODEL_DIR, current_datetime(),)

# Logging:
Expand Down

0 comments on commit e1d9df7

Please sign in to comment.