Skip to content

Commit 89dc8ec

Browse files
author
tibuch
authored
Merge pull request #13 from juglab/merger
v0.1.17
2 parents e8ef4c0 + 90db96c commit 89dc8ec

File tree

4 files changed

+145
-8
lines changed

4 files changed

+145
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Build Python package:
66
`python setup.py bdist_wheel`
77

88
Build singularity recipe:
9-
`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`
9+
`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`
1010

1111
Build singularity container:
12-
`sudo singularity build fit_v0.1.16.simg v0.1.16.Singularity`
12+
`sudo singularity build fit_v0.1.17.simg v0.1.17.Singularity`

fit/modules/TRecTransformerModule.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,10 @@ def validation_epoch_end(self, outputs):
229229
phi_loss = [d['phi_loss'] for d in outputs]
230230
mean_val_mse = torch.mean(torch.stack(val_mse))
231231
mean_val_psnr = torch.mean(torch.stack(val_psnr))
232-
mean_bin_mse = torch.mean(torch.stack(bin_mse))
233-
if self.bin_count > self.hparams.bin_factor_cd and mean_val_mse < (
234-
self.hparams.alpha * mean_bin_mse) and self.bin_factor > 1:
232+
bin_factor_threshold = torch.mean(torch.stack(bin_mse)) * self.bin_factor
233+
if self.bin_count > self.hparams.bin_factor_cd and mean_val_mse < bin_factor_threshold and self.bin_factor > 1:
235234
self.bin_count = 0
236-
self.bin_factor = max(1, self.bin_factor - 1)
235+
self.bin_factor = max(1, self.bin_factor // 2)
237236
self.register_buffer('mask', psfft(self.bin_factor, pixel_res=self.hparams.img_shape).to(self.device))
238237
print('Reduced bin_factor to {}.'.format(self.bin_factor))
239238

@@ -245,7 +244,7 @@ def validation_epoch_end(self, outputs):
245244
self.log('Train/avg_val_loss', torch.mean(torch.stack(val_loss)), logger=True, on_epoch=True)
246245
self.log('Train/avg_val_mse', mean_val_mse, logger=True, on_epoch=True)
247246
self.log('Train/avg_val_psnr', mean_val_psnr, logger=True, on_epoch=True)
248-
self.log('Train/avg_bin_mse', mean_bin_mse, logger=True, on_epoch=True)
247+
self.log('Train/avg_bin_mse', bin_factor_threshold, logger=True, on_epoch=True)
249248
self.log('Train/avg_val_amp_loss', torch.mean(torch.stack(amp_loss)), logger=True, on_epoch=True)
250249
self.log('Train/avg_val_phi_loss', torch.mean(torch.stack(phi_loss)), logger=True, on_epoch=True)
251250

fit/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.1.16'
1+
__version__ = '0.1.17'

singularity/v0.1.17.Singularity

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Generated by: Neurodocker version 0.7.0
2+
# Latest release: Neurodocker version 0.7.0
3+
# Timestamp: 2021/01/26 06:27:03 UTC
4+
#
5+
# Thank you for using Neurodocker. If you discover any issues
6+
# or ways to improve this software, please submit an issue or
7+
# pull request on our GitHub repository:
8+
#
9+
# https://github.com/ReproNim/neurodocker
10+
11+
Bootstrap: docker
12+
From: nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04
13+
14+
%post
15+
su - root
16+
17+
export ND_ENTRYPOINT="/neurodocker/startup.sh"
18+
apt-get update -qq
19+
apt-get install -y -q --no-install-recommends \
20+
apt-utils \
21+
bzip2 \
22+
ca-certificates \
23+
curl \
24+
locales \
25+
unzip
26+
apt-get clean
27+
rm -rf /var/lib/apt/lists/*
28+
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
29+
dpkg-reconfigure --frontend=noninteractive locales
30+
update-locale LANG="en_US.UTF-8"
31+
chmod 777 /opt && chmod a+s /opt
32+
mkdir -p /neurodocker
33+
if [ ! -f "$ND_ENTRYPOINT" ]; then
34+
echo '#!/usr/bin/env bash' >> "$ND_ENTRYPOINT"
35+
echo 'set -e' >> "$ND_ENTRYPOINT"
36+
echo 'export USER="${USER:=`whoami`}"' >> "$ND_ENTRYPOINT"
37+
echo 'if [ -n "$1" ]; then "$@"; else /usr/bin/env bash; fi' >> "$ND_ENTRYPOINT";
38+
fi
39+
chmod -R 777 /neurodocker && chmod a+s /neurodocker
40+
41+
export PATH="/opt/miniconda-latest/bin:$PATH"
42+
echo "Downloading Miniconda installer ..."
43+
conda_installer="/tmp/miniconda.sh"
44+
curl -fsSL --retry 5 -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
45+
bash "$conda_installer" -b -p /opt/miniconda-latest
46+
rm -f "$conda_installer"
47+
conda update -yq -nbase conda
48+
conda config --system --prepend channels conda-forge
49+
conda config --system --set auto_update_conda false
50+
conda config --system --set show_channel_urls true
51+
sync && conda clean -y --all && sync
52+
conda create -y -q --name fit
53+
conda install -y -q --name fit \
54+
"python=3.7" \
55+
"astra-toolbox" \
56+
"pytorch" \
57+
"torchvision" \
58+
"torchaudio" \
59+
"cudatoolkit=10.2" \
60+
"-c" \
61+
"pytorch" \
62+
"-c" \
63+
"astra-toolbox/label/dev"
64+
sync && conda clean -y --all && sync
65+
bash -c "source activate fit
66+
pip install --no-cache-dir \
67+
"/fourier_image_transformers-0.1.17-py3-none-any.whl""
68+
rm -rf ~/.cache/pip/*
69+
sync
70+
sed -i '$isource activate fit' $ND_ENTRYPOINT
71+
72+
73+
echo '{
74+
\n "pkg_manager": "apt",
75+
\n "instructions": [
76+
\n [
77+
\n "base",
78+
\n "nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04"
79+
\n ],
80+
\n [
81+
\n "user",
82+
\n "root"
83+
\n ],
84+
\n [
85+
\n "_header",
86+
\n {
87+
\n "version": "generic",
88+
\n "method": "custom"
89+
\n }
90+
\n ],
91+
\n [
92+
\n "copy",
93+
\n [
94+
\n "/home/tibuch/Gitrepos/FourierImageTransformer/dist/fourier_image_transformers-0.1.17-py3-none-any.whl",
95+
\n "/fourier_image_transformers-0.1.17-py3-none-any.whl"
96+
\n ]
97+
\n ],
98+
\n [
99+
\n "miniconda",
100+
\n {
101+
\n "create_env": "fit",
102+
\n "conda_install": [
103+
\n "python=3.7",
104+
\n "astra-toolbox",
105+
\n "pytorch",
106+
\n "torchvision",
107+
\n "torchaudio",
108+
\n "cudatoolkit=10.2",
109+
\n "-c",
110+
\n "pytorch",
111+
\n "-c",
112+
\n "astra-toolbox/label/dev"
113+
\n ],
114+
\n "pip_install": [
115+
\n "/fourier_image_transformers-0.1.17-py3-none-any.whl"
116+
\n ],
117+
\n "activate": true
118+
\n }
119+
\n ],
120+
\n [
121+
\n "entrypoint",
122+
\n "/neurodocker/startup.sh python"
123+
\n ]
124+
\n ]
125+
\n}' > /neurodocker/neurodocker_specs.json
126+
127+
%environment
128+
export LANG="en_US.UTF-8"
129+
export LC_ALL="en_US.UTF-8"
130+
export ND_ENTRYPOINT="/neurodocker/startup.sh"
131+
export CONDA_DIR="/opt/miniconda-latest"
132+
export PATH="/opt/miniconda-latest/bin:$PATH"
133+
134+
%files
135+
/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
136+
137+
%runscript
138+
/neurodocker/startup.sh python

0 commit comments

Comments
 (0)