Skip to content

Commit

Permalink
New Singularity version + deleted tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneNx committed May 25, 2022
1 parent 6585ed1 commit a6866d3
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 251 deletions.
2 changes: 2 additions & 0 deletions Singularity.v0.2.def
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ From: ghcr.io/sinzlab/pytorch-singularity:v3.9-torch1.10.2-dj0.12.7.def
# dvipng \




python3.9 -m pip --no-cache-dir install \
ipykernel \
requests \
Expand Down
114 changes: 114 additions & 0 deletions Singularity.v0.4.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
BootStrap: docker
From: ubuntu:21.10

%labels
MAINTAINER Arne Nix <[email protected]>
%files
../bias_transfer /src/bias_transfer
../nntransfer /src/nntransfer
../neuralpredictors /src/neuralpredictors
../pytorch_warmup /src/pytorch_warmup
../nnfabrik /src/nnfabrik
../ffcv /src/ffcv

%environment
export PATH="/opt/conda/bin:${PATH}"

%post
apt update && apt install -y software-properties-common
add-apt-repository universe

apt update && apt install -y \
build-essential \
git \
wget \
vim \
curl \
zip \
zlib1g-dev \
unzip \
pkg-config \
libblas-dev \
liblapack-dev \
python3-tk \
python3-wheel \
graphviz \
libhdf5-dev \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-base \
dvipng


# apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*
# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
# && mkdir /root/.conda \
# && bash Miniconda3-latest-Linux-x86_64.sh -b \
# && rm -f Miniconda3-latest-Linux-x86_64.sh

curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda install -y python=${PYTHON_VERSION} conda-build pyyaml numpy ipython&& \
/opt/conda/bin/conda clean -ya

export PATH="/opt/conda/bin:${PATH}"

# conda create -y -n ffcv python=3.9 ipython cupy pkg-config compilers libjpeg-turbo opencv pytorch torchvision cudatoolkit=11.3 numba -c pytorch -c conda-forge
conda create -y -n ffcv python=3.9 ipython cupy pkg-config compilers libjpeg-turbo opencv numba -c conda-forge

echo "source activate" >> ~/.bashrc
echo "conda activate ffcv" >> ~/.bashrc

conda run -n ffcv pip --no-cache-dir install \
torch==1.10.2+cu113 \
torchvision==0.11.3+cu113 \
torchaudio==0.10.2+cu113 \
-f https://download.pytorch.org/whl/cu113/torch_stable.html


conda run -n ffcv pip install --no-cache-dir jupyterlab_vim \
checkout_code \
requests \
imageio \
scikit-image \
einops \
vit-pytorch \
blackcellmagic\
pytest \
pytest-cov \
numpy \
matplotlib \
scipy \
pandas \
jupyter \
scikit-learn \
scikit-image \
seaborn \
graphviz \
gpustat \
h5py \
gitpython \
Pillow==8.0.1 \
jupyterlab \
ipykernel \
opencv-python \
datajoint==0.12.7

conda run -n ffcv pip install -e /src/bias_transfer
conda run -n ffcv pip install -e /src/nntransfer
conda run -n ffcv pip install -e /src/nnfabrik
conda run -n ffcv pip install -e /src/neuralpredictors
conda run -n ffcv pip install -e /src/pytorch_warmup
conda run -n ffcv pip install -e /src/ffcv

conda run -n ffcv python -m ipykernel install --user --name=ffcv

%startscript
exec "$@"

%runscript
exec "$@"


14 changes: 9 additions & 5 deletions nntransfer/analysis/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def plot_wrapper(*args, **kwargs):
if "talk" in style or "beamer" in style:
sns.set_context("talk")
font = "sans-serif"
small_fontsize = 13
xsmall_fontsize = 13
normal_fontsize = 14
large_fontsize = 17
small_fontsize = 14
xsmall_fontsize = 14
normal_fontsize = 15
large_fontsize = 16
else:
sns.set_context("paper")
font = "serif"
Expand Down Expand Up @@ -106,7 +106,9 @@ def plot_wrapper(*args, **kwargs):
for i in range(len(ax)):
ax[i] = [ax[i]]

plt.grid(True, linestyle=":", linewidth=0.5)
for i in range(len(ax)):
for j in range(len(ax[i])):
ax[i][j].grid(True, linestyle=":", linewidth=0.8)

# execute the actual plotting
plot_function(*args, fig=fig, ax=ax, **kwargs)
Expand Down Expand Up @@ -215,11 +217,13 @@ def set_size(style, ratio=None, fraction=1, subplots=(1, 1), gridspec_kw=None):

def save_plot(fig, name, types=("pgf", "pdf", "png")):
for file_type in types:
fig.patch.set_alpha(0.0)
fig.savefig(
name + "." + file_type,
facecolor=fig.get_facecolor(),
edgecolor=fig.get_edgecolor(),
bbox_inches="tight",
transparent=True
)
plt.close(fig)

Expand Down
4 changes: 2 additions & 2 deletions nntransfer/configs/trainer/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def __init__(self, **kwargs):
"keep_selection": (),
}
self.keep_checkpoints: bool = False
self.patience: int = 10
self.patience: int = None
self.threshold: float = 0.0001
self.verbose: bool = False
self.lr_milestones: Tuple = (30, 60)
self.lr_milestones: Tuple = ()
self.min_lr: float = 0.00001 # lr scheduler min learning rate
self.threshold_mode: str = "rel"
self.train_cycler: str = "LongCycler"
Expand Down
1 change: 1 addition & 0 deletions nntransfer/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ def train(self):
test_result = self.test_final_model(epoch)

copy_ensemble_param_to_buffer(self.model, self.config.ensemble_iteration)
print(self.model.state_dict().keys())

if self.config.switch_teacher:
return (
Expand Down
Loading

0 comments on commit a6866d3

Please sign in to comment.