Skip to content

Commit

Permalink
Merge pull request #13 from juglab/merger
Browse files Browse the repository at this point in the history
v0.1.17
  • Loading branch information
tibuch authored Feb 5, 2021
2 parents e8ef4c0 + 90db96c commit 89dc8ec
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
9 changes: 4 additions & 5 deletions fit/modules/TRecTransformerModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion fit/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.16'
__version__ = '0.1.17'
138 changes: 138 additions & 0 deletions singularity/v0.1.17.Singularity
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 89dc8ec

Please sign in to comment.