From 8fdf735d053a0336ead4301dae2553da03c74ea2 Mon Sep 17 00:00:00 2001 From: tibuch Date: Fri, 5 Feb 2021 09:49:30 +0100 Subject: [PATCH 1/3] Divide bin-factor by 2 instead of reducing by 1. --- fit/modules/TRecTransformerModule.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fit/modules/TRecTransformerModule.py b/fit/modules/TRecTransformerModule.py index ecf5e07..26748f2 100644 --- a/fit/modules/TRecTransformerModule.py +++ b/fit/modules/TRecTransformerModule.py @@ -229,11 +229,10 @@ def validation_epoch_end(self, outputs): phi_loss = [d['phi_loss'] for d in outputs] mean_val_mse = torch.mean(torch.stack(val_mse)) mean_val_psnr = torch.mean(torch.stack(val_psnr)) - mean_bin_mse = torch.mean(torch.stack(bin_mse)) - if self.bin_count > self.hparams.bin_factor_cd and mean_val_mse < ( - self.hparams.alpha * mean_bin_mse) and self.bin_factor > 1: + bin_factor_threshold = torch.mean(torch.stack(bin_mse)) * self.bin_factor + if self.bin_count > self.hparams.bin_factor_cd and mean_val_mse < bin_factor_threshold and self.bin_factor > 1: self.bin_count = 0 - self.bin_factor = max(1, self.bin_factor - 1) + self.bin_factor = max(1, self.bin_factor // 2) self.register_buffer('mask', psfft(self.bin_factor, pixel_res=self.hparams.img_shape).to(self.device)) print('Reduced bin_factor to {}.'.format(self.bin_factor)) @@ -245,7 +244,7 @@ def validation_epoch_end(self, outputs): self.log('Train/avg_val_loss', torch.mean(torch.stack(val_loss)), logger=True, on_epoch=True) self.log('Train/avg_val_mse', mean_val_mse, logger=True, on_epoch=True) self.log('Train/avg_val_psnr', mean_val_psnr, logger=True, on_epoch=True) - self.log('Train/avg_bin_mse', mean_bin_mse, logger=True, on_epoch=True) + self.log('Train/avg_bin_mse', bin_factor_threshold, logger=True, on_epoch=True) self.log('Train/avg_val_amp_loss', torch.mean(torch.stack(amp_loss)), logger=True, on_epoch=True) self.log('Train/avg_val_phi_loss', torch.mean(torch.stack(phi_loss)), logger=True, on_epoch=True) From 55df1db4d41b83a6553cdbc095dfe91c418f2f43 Mon Sep 17 00:00:00 2001 From: tibuch Date: Fri, 5 Feb 2021 09:49:43 +0100 Subject: [PATCH 2/3] Bump version and update README.md. --- README.md | 4 ++-- fit/version.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 585f151..b2a094d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Build Python package: `python setup.py bdist_wheel` Build singularity recipe: -`neurodocker generate singularity -b nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04 -p apt --copy /home/tibuch/Gitrepos/FourierImageTransformer/dist/fourier_image_transformers-0.1.16-py3-none-any.whl /fourier_image_transformers-0.1.16-py3-none-any.whl --miniconda create_env=fit conda_install='python=3.7 astra-toolbox pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch -c astra-toolbox/label/dev' pip_install='/fourier_image_transformers-0.1.16-py3-none-any.whl' activate=true --entrypoint "/neurodocker/startup.sh python" > v0.1.16.Singularity` +`neurodocker generate singularity -b nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04 -p apt --copy /home/tibuch/Gitrepos/FourierImageTransformer/dist/fourier_image_transformers-0.1.17-py3-none-any.whl /fourier_image_transformers-0.1.17-py3-none-any.whl --miniconda create_env=fit conda_install='python=3.7 astra-toolbox pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch -c astra-toolbox/label/dev' pip_install='/fourier_image_transformers-0.1.17-py3-none-any.whl' activate=true --entrypoint "/neurodocker/startup.sh python" > v0.1.17.Singularity` Build singularity container: -`sudo singularity build fit_v0.1.16.simg v0.1.16.Singularity` +`sudo singularity build fit_v0.1.17.simg v0.1.17.Singularity` diff --git a/fit/version.py b/fit/version.py index b7e15fa..b04cffb 100644 --- a/fit/version.py +++ b/fit/version.py @@ -1 +1 @@ -__version__ = '0.1.16' +__version__ = '0.1.17' From 90db96cdbab4c98bb141cda89584e410062d3fa2 Mon Sep 17 00:00:00 2001 From: tibuch Date: Fri, 5 Feb 2021 09:49:53 +0100 Subject: [PATCH 3/3] Add v0.1.17 singularity recipe. --- singularity/v0.1.17.Singularity | 138 ++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 singularity/v0.1.17.Singularity diff --git a/singularity/v0.1.17.Singularity b/singularity/v0.1.17.Singularity new file mode 100644 index 0000000..83e64b7 --- /dev/null +++ b/singularity/v0.1.17.Singularity @@ -0,0 +1,138 @@ +# Generated by: Neurodocker version 0.7.0 +# Latest release: Neurodocker version 0.7.0 +# Timestamp: 2021/01/26 06:27:03 UTC +# +# Thank you for using Neurodocker. If you discover any issues +# or ways to improve this software, please submit an issue or +# pull request on our GitHub repository: +# +# https://github.com/ReproNim/neurodocker + +Bootstrap: docker +From: nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04 + +%post +su - root + +export ND_ENTRYPOINT="/neurodocker/startup.sh" +apt-get update -qq +apt-get install -y -q --no-install-recommends \ + apt-utils \ + bzip2 \ + ca-certificates \ + curl \ + locales \ + unzip +apt-get clean +rm -rf /var/lib/apt/lists/* +sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen +dpkg-reconfigure --frontend=noninteractive locales +update-locale LANG="en_US.UTF-8" +chmod 777 /opt && chmod a+s /opt +mkdir -p /neurodocker +if [ ! -f "$ND_ENTRYPOINT" ]; then + echo '#!/usr/bin/env bash' >> "$ND_ENTRYPOINT" + echo 'set -e' >> "$ND_ENTRYPOINT" + echo 'export USER="${USER:=`whoami`}"' >> "$ND_ENTRYPOINT" + echo 'if [ -n "$1" ]; then "$@"; else /usr/bin/env bash; fi' >> "$ND_ENTRYPOINT"; +fi +chmod -R 777 /neurodocker && chmod a+s /neurodocker + +export PATH="/opt/miniconda-latest/bin:$PATH" +echo "Downloading Miniconda installer ..." +conda_installer="/tmp/miniconda.sh" +curl -fsSL --retry 5 -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh +bash "$conda_installer" -b -p /opt/miniconda-latest +rm -f "$conda_installer" +conda update -yq -nbase conda +conda config --system --prepend channels conda-forge +conda config --system --set auto_update_conda false +conda config --system --set show_channel_urls true +sync && conda clean -y --all && sync +conda create -y -q --name fit +conda install -y -q --name fit \ + "python=3.7" \ + "astra-toolbox" \ + "pytorch" \ + "torchvision" \ + "torchaudio" \ + "cudatoolkit=10.2" \ + "-c" \ + "pytorch" \ + "-c" \ + "astra-toolbox/label/dev" +sync && conda clean -y --all && sync +bash -c "source activate fit + pip install --no-cache-dir \ + "/fourier_image_transformers-0.1.17-py3-none-any.whl"" +rm -rf ~/.cache/pip/* +sync +sed -i '$isource activate fit' $ND_ENTRYPOINT + + +echo '{ +\n "pkg_manager": "apt", +\n "instructions": [ +\n [ +\n "base", +\n "nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04" +\n ], +\n [ +\n "user", +\n "root" +\n ], +\n [ +\n "_header", +\n { +\n "version": "generic", +\n "method": "custom" +\n } +\n ], +\n [ +\n "copy", +\n [ +\n "/home/tibuch/Gitrepos/FourierImageTransformer/dist/fourier_image_transformers-0.1.17-py3-none-any.whl", +\n "/fourier_image_transformers-0.1.17-py3-none-any.whl" +\n ] +\n ], +\n [ +\n "miniconda", +\n { +\n "create_env": "fit", +\n "conda_install": [ +\n "python=3.7", +\n "astra-toolbox", +\n "pytorch", +\n "torchvision", +\n "torchaudio", +\n "cudatoolkit=10.2", +\n "-c", +\n "pytorch", +\n "-c", +\n "astra-toolbox/label/dev" +\n ], +\n "pip_install": [ +\n "/fourier_image_transformers-0.1.17-py3-none-any.whl" +\n ], +\n "activate": true +\n } +\n ], +\n [ +\n "entrypoint", +\n "/neurodocker/startup.sh python" +\n ] +\n ] +\n}' > /neurodocker/neurodocker_specs.json + +%environment +export LANG="en_US.UTF-8" +export LC_ALL="en_US.UTF-8" +export ND_ENTRYPOINT="/neurodocker/startup.sh" +export CONDA_DIR="/opt/miniconda-latest" +export PATH="/opt/miniconda-latest/bin:$PATH" + +%files +/home/tibuch/Gitrepos/FourierImageTransformer/dist/fourier_image_transformers-0.1.17-py3-none-any.whl /fourier_image_transformers-0.1.17-py3-none-any.whl + +%runscript +/neurodocker/startup.sh python