From 0b2148f8fe344c81044bdee3ee83efa9d4cf4934 Mon Sep 17 00:00:00 2001 From: Robert Jan Schlimbach Date: Tue, 11 Jan 2022 13:12:50 +0100 Subject: [PATCH] environment and import fix --- environment.yml | 279 +++++++++--------- {pixel-model => pixel_model}/layers.py | 0 {pixel-model => pixel_model}/pixelcnn.py | 4 +- {pixel-model => pixel_model}/pixelsnail.py | 4 +- .../sample_embeddings.py | 4 +- {pixel-model => pixel_model}/test.py | 2 +- {pixel-model => pixel_model}/train.py | 4 +- {pixel-model => pixel_model}/train_helpers.py | 0 vqvae/calc_ssim_from_checkpoint.py | 2 +- vqvae/decode_embeddings.py | 2 +- vqvae/extract_embeddings.py | 2 +- vqvae/layers.py | 2 +- vqvae/model.py | 2 +- vqvae/plot_from_checkpoint.py | 2 +- vqvae/train.py | 2 +- 15 files changed, 153 insertions(+), 158 deletions(-) rename {pixel-model => pixel_model}/layers.py (100%) rename {pixel-model => pixel_model}/pixelcnn.py (98%) rename {pixel-model => pixel_model}/pixelsnail.py (98%) rename {pixel-model => pixel_model}/sample_embeddings.py (98%) rename {pixel-model => pixel_model}/test.py (95%) rename {pixel-model => pixel_model}/train.py (96%) rename {pixel-model => pixel_model}/train_helpers.py (100%) diff --git a/environment.yml b/environment.yml index f37a36c..686fca5 100644 --- a/environment.yml +++ b/environment.yml @@ -1,158 +1,153 @@ -name: pytorch1.7 +name: py38 channels: - - simpleitk - - pytorch-nightly - - conda-forge + - pytorch - defaults + - conda-forge dependencies: - _libgcc_mutex=0.1=main - - _pytorch_select=0.2=gpu_0 - - absl-py=0.9.0=py38h32f6830_1 + - _openmp_mutex=4.5=1_gnu + - absl-py=0.15.0=pyhd3eb1b0_0 + - aiohttp=3.8.1=py38h7f8727e_0 + - aiosignal=1.2.0=pyhd3eb1b0_0 + - async-timeout=4.0.1=pyhd3eb1b0_0 + - attrs=21.2.0=pyhd3eb1b0_0 - blas=1.0=mkl - - blinker=1.4=py_1 - - brotlipy=0.7.0=py38h1e0a361_1000 + - blinker=1.4=py38h06a4308_0 + - brotli=1.0.9=he6710b0_2 + - brotlipy=0.7.0=py38h27cfd23_1003 - bzip2=1.0.8=h7b6447c_0 - - c-ares=1.16.1=h516909a_2 - - ca-certificates=2021.1.19=h06a4308_0 - - cachetools=4.1.1=py_0 - - certifi=2020.12.5=py38h06a4308_0 - - cffi=1.14.1=py38he30daa8_0 - - chardet=3.0.4=py38h32f6830_1006 - - click=7.1.2=pyh9f0ad1d_0 - - cryptography=3.0=py38h766eaa4_0 - - cudatoolkit=11.0.221=h6bb024c_0 - - cycler=0.10.0=py_2 - - dbus=1.13.16=hb2f20db_0 - - einops=0.3.0=py_0 - - expat=2.2.9=he6710b0_2 - - ffmpeg=4.2.2=h20bf706_0 - - filelock=3.0.12=pyhd3eb1b0_1 - - fontconfig=2.13.0=h9420a91_0 - - freetype=2.10.4=h5ab3b9f_0 - - future=0.18.2=py38h32f6830_1 - - gdcm=2.8.9=py38h138f8cb_1 - - glib=2.65.0=h3eb4bd4_0 - - gmp=6.1.2=h6c8ec71_1 - - gnutls=3.6.5=h71b1129_1002 - - google-auth=1.20.1=py_0 - - google-auth-oauthlib=0.4.1=py_2 - - grpcio=1.31.0=py38h2c89da0_0 - - gst-plugins-base=1.14.0=hbbd80ab_1 - - gstreamer=1.14.0=hb31296c_0 - - h5py=2.10.0=py38hd6299e0_1 - - hdf5=1.10.6=hb1b8bf9_0 + - c-ares=1.17.1=h27cfd23_0 + - ca-certificates=2021.10.26=h06a4308_2 + - cached-property=1.5.2=hd8ed1ab_1 + - cached_property=1.5.2=pyha770c72_1 + - cachetools=4.2.2=pyhd3eb1b0_0 + - certifi=2021.10.8=py38h06a4308_0 + - cffi=1.14.6=py38h400218f_0 + - charset-normalizer=2.0.4=pyhd3eb1b0_0 + - click=8.0.3=pyhd3eb1b0_0 + - cryptography=3.4.8=py38hd23ed53_0 + - cudatoolkit=11.3.1=h2bc3f7f_2 + - cycler=0.11.0=pyhd3eb1b0_0 + - dataclasses=0.8=pyh6d0b6a4_7 + - dbus=1.13.18=hb2f20db_0 + - einops=0.3.2=pyhd8ed1ab_0 + - expat=2.4.1=h2531618_2 + - ffmpeg=4.3=hf484d3e_0 + - filelock=3.4.2=pyhd8ed1ab_1 + - fontconfig=2.13.1=h6c09931_0 + - fonttools=4.25.0=pyhd3eb1b0_0 + - freetype=2.11.0=h70c0345_0 + - frozenlist=1.2.0=py38h7f8727e_0 + - fsspec=2021.10.1=pyhd3eb1b0_0 + - future=0.18.2=py38_1 + - giflib=5.2.1=h7b6447c_0 + - glib=2.69.1=h5202010_0 + - gmp=6.2.1=h2531618_2 + - gnutls=3.6.15=he1e5248_0 + - google-auth=1.33.0=pyhd3eb1b0_0 + - google-auth-oauthlib=0.4.4=pyhd3eb1b0_0 + - grpcio=1.42.0=py38hce63b2e_0 + - gst-plugins-base=1.14.0=h8213a91_2 + - gstreamer=1.14.0=h28cd5cc_2 + - h5py=3.6.0=py38ha0f2276_0 + - hdf5=1.10.6=nompi_h3c11f04_101 - icu=58.2=he6710b0_3 - - idna=2.10=pyh9f0ad1d_0 - - importlib-metadata=1.7.0=py38h32f6830_0 - - intel-openmp=2020.1=217 - - jpeg=9b=h024ee3a_2 - - json-c=0.13.1=h1bed415_0 - - kiwisolver=1.2.0=py38hbf85e49_0 + - idna=3.3=pyhd3eb1b0_0 + - importlib-metadata=4.8.2=py38h06a4308_0 + - intel-openmp=2021.4.0=h06a4308_3561 + - jpeg=9d=h7f8727e_0 + - kiwisolver=1.3.1=py38h2531618_0 - lame=3.100=h7b6447c_0 - - lcms2=2.11=h396b838_0 - - ld_impl_linux-64=2.33.1=h53a641e_7 - - libedit=3.1.20181209=hc058e9b_0 - - libffi=3.3=he6710b0_1 - - libgcc-ng=9.1.0=hdf63c60_0 - - libgfortran-ng=7.3.0=hdf63c60_0 - - libjpeg-turbo=2.0.5=h516909a_0 - - libopus=1.3.1=h7b6447c_0 + - lcms2=2.12=h3be6417_0 + - ld_impl_linux-64=2.35.1=h7274673_9 + - libffi=3.3=he6710b0_2 + - libgcc-ng=9.3.0=h5101ec6_17 + - libgfortran-ng=7.5.0=ha8ba4b0_17 + - libgfortran4=7.5.0=ha8ba4b0_17 + - libgomp=9.3.0=h5101ec6_17 + - libiconv=1.15=h63c8f33_5 + - libidn2=2.3.2=h7f8727e_0 - libpng=1.6.37=hbc83047_0 - - libprotobuf=3.13.0=h8b12597_0 - - libstdcxx-ng=9.1.0=hdf63c60_0 - - libtiff=4.1.0=h2733197_1 - - libuuid=1.0.3=h1bed415_2 + - libprotobuf=3.19.1=h4ff587b_0 + - libstdcxx-ng=9.3.0=hd4cf53a_17 + - libtasn1=4.16.0=h27cfd23_0 + - libtiff=4.2.0=h85742a9_0 + - libunistring=0.9.10=h27cfd23_0 + - libuuid=1.0.3=h7f8727e_2 - libuv=1.40.0=h7b6447c_0 - - libvpx=1.7.0=h439df22_0 + - libwebp=1.2.0=h89dd481_0 + - libwebp-base=1.2.0=h27cfd23_0 - libxcb=1.14=h7b6447c_0 - - libxml2=2.9.10=he19cac6_1 - - lz4-c=1.9.2=he6710b0_0 - - markdown=3.2.2=py_0 - - matplotlib=3.1.3=py38_0 - - matplotlib-base=3.1.3=py38hef1b27d_0 - - mkl=2020.1=217 - - mkl-service=2.3.0=py38he904b0f_0 - - mkl_fft=1.1.0=py38h23d657b_0 - - mkl_random=1.1.1=py38h0573a6f_0 - - ncurses=6.2=he6710b0_1 - - nettle=3.4.1=hbb512f6_0 - - ninja=1.9.0=py38hfd86e86_0 - - numpy=1.18.1=py38h4f9e942_0 - - numpy-base=1.18.1=py38hde5b4d6_1 - - oauthlib=3.0.1=py_0 - - olefile=0.46=py_0 - - openh264=2.1.0=hd408876_0 - - openjpeg=2.3.1=h981e76c_3 - - openssl=1.1.1i=h27cfd23_0 - - packaging=20.4=py_0 - - pcre=8.44=he6710b0_0 - - pillow=8.0.1=py38he98fc37_0 - - protobuf=3.13.0=py38h950e882_0 - - pyasn1=0.4.8=py_0 - - pyasn1-modules=0.2.7=py_0 - - pycparser=2.20=pyh9f0ad1d_2 - - pydicom=2.1.0=pyhd3deb0d_0 - - pyjwt=1.7.1=py_0 + - libxml2=2.9.12=h03d6c58_0 + - lz4-c=1.9.3=h295c915_1 + - markdown=3.3.4=py38h06a4308_0 + - matplotlib=3.5.0=py38h06a4308_0 + - matplotlib-base=3.5.0=py38h3ed280b_0 + - mkl=2021.4.0=h06a4308_640 + - mkl-service=2.4.0=py38h7f8727e_0 + - mkl_fft=1.3.1=py38hd3c417c_0 + - mkl_random=1.2.2=py38h51133e4_0 + - monai=0.8.0=pyhd8ed1ab_1 + - multidict=5.2.0=py38h7f8727e_2 + - munkres=1.1.4=py_0 + - ncurses=6.3=h7f8727e_2 + - nettle=3.7.3=hbbd107a_1 + - numpy=1.21.2=py38h20f2e39_0 + - numpy-base=1.21.2=py38h79a1101_0 + - oauthlib=3.1.1=pyhd3eb1b0_0 + - olefile=0.46=pyhd3eb1b0_0 + - openh264=2.1.1=h4ff587b_0 + - openssl=1.1.1l=h7f8727e_0 + - packaging=21.3=pyhd3eb1b0_0 + - pcre=8.45=h295c915_0 + - pillow=8.4.0=py38h5aabda8_0 + - pip=21.2.4=py38h06a4308_0 + - protobuf=3.19.1=py38h295c915_0 + - pyasn1=0.4.8=pyhd3eb1b0_0 + - pyasn1-modules=0.2.8=py_0 + - pycparser=2.21=pyhd3eb1b0_0 + - pydicom=2.2.2=pyh6c4a22f_0 + - pyjwt=2.1.0=py38h06a4308_0 - pynrrd=0.4.2=pyh95af2a2_0 - - pyopenssl=19.1.0=py_1 - - pyparsing=2.4.7=pyh9f0ad1d_0 + - pyopenssl=21.0.0=pyhd3eb1b0_1 + - pyparsing=3.0.4=pyhd3eb1b0_0 - pyqt=5.9.2=py38h05f1152_4 - - pysocks=1.7.1=py38h32f6830_1 - - python=3.8.3=hcff3b4d_0 - - python-dateutil=2.8.1=py_0 - - python-lmdb=0.98=py38he6710b0_0 - - python_abi=3.8=1_cp38 - - pytorch=1.8.0.dev20210122=py3.8_cuda11.0.221_cudnn8.0.5_0 - - pyyaml=5.3.1=py38h1e0a361_0 + - pysocks=1.7.1=py38h06a4308_0 + - python=3.8.12=h12debd9_0 + - python-dateutil=2.8.2=pyhd3eb1b0_0 + - python-lmdb=0.99=py38h709712a_0 + - python_abi=3.8=2_cp38 + - pytorch=1.10.1=py3.8_cuda11.3_cudnn8.2.0_0 + - pytorch-lightning=1.2.10=pyhd8ed1ab_0 + - pytorch-mutex=1.0=cuda + - pyyaml=6.0=py38h7f8727e_1 - qt=5.9.7=h5867ecd_1 - - readline=8.0=h7b6447c_0 - - requests=2.24.0=pyh9f0ad1d_0 - - requests-oauthlib=1.3.0=pyh9f0ad1d_0 - - rsa=4.6=pyh9f0ad1d_0 - - setuptools=51.0.0=py38h06a4308_2 - - simpleitk=2.0rc3=py38hf484d3e_0 + - readline=8.1.2=h7f8727e_0 + - requests=2.27.1=pyhd3eb1b0_0 + - requests-oauthlib=1.3.0=py_0 + - rsa=4.7.2=pyhd3eb1b0_1 + - scipy=1.7.3=py38hc147768_0 + - setuptools=58.0.4=py38h06a4308_0 - sip=4.19.13=py38he6710b0_0 - - six=1.15.0=py_0 - - sqlite=3.31.1=h62c20be_1 - - tensorboard=2.3.0=pyh4dce500_0 - - tensorboard-plugin-wit=1.6.0=pyh9f0ad1d_0 - - tk=8.6.8=hbc83047_0 - - torchvision=0.9.0.dev20210122=py38_cu110 - - tornado=6.0.4=py38h1e0a361_1 - - tqdm=4.48.2=pyh9f0ad1d_0 - - typing_extensions=3.7.4.3=py_0 - - urllib3=1.25.10=py_0 - - werkzeug=1.0.1=pyh9f0ad1d_0 - - wheel=0.36.2=pyhd3eb1b0_0 - - x264=1!157.20191217=h7b6447c_0 + - six=1.16.0=pyhd3eb1b0_0 + - sqlite=3.37.0=hc218d9a_0 + - tensorboard=2.4.0=pyhc547734_0 + - tensorboard-plugin-wit=1.6.0=py_0 + - tk=8.6.11=h1ccaba5_0 + - torchaudio=0.10.1=py38_cu113 + - torchmetrics=0.6.2=pyhd8ed1ab_0 + - torchvision=0.11.2=py38_cu113 + - tornado=6.1=py38h27cfd23_0 + - tqdm=4.62.3=pyhd3eb1b0_1 + - typing-extensions=3.10.0.2=hd3eb1b0_0 + - typing_extensions=3.10.0.2=pyh06a4308_0 + - urllib3=1.26.7=pyhd3eb1b0_0 + - werkzeug=2.0.2=pyhd3eb1b0_0 + - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.2.5=h7b6447c_0 - - yaml=0.2.5=h516909a_0 - - zipp=3.1.0=py_0 - - zlib=1.2.11=h7b6447c_3 - - zstd=1.4.4=h0b5b093_3 - - pip: - - aiohttp==3.7.3 - - async-timeout==3.0.1 - - attrs==20.3.0 - - dataclasses==0.6 - - fairscale==0.1.5 - - fsspec==0.8.4 - - itk==5.1.1 - - itk-core==5.1.1 - - itk-filtering==5.1.1 - - itk-io==5.1.1 - - itk-numerics==5.1.1 - - itk-registration==5.1.1 - - itk-segmentation==5.1.1 - - monai==0.3.0 - - multidict==5.1.0 - - nibabel==3.1.1 - - omegaconf==2.0.5 - - onnxruntime==1.6.0 - - pip==21.0.1 - - python-graphviz==0.16 - - pytorch-lightning==1.2.0.dev0 - - torchviz==0.0.1 - - yarl==1.6.3 -prefix: /home/robertsc/.conda/envs/pytorch1.7 - + - yaml=0.2.5=h7b6447c_0 + - yarl=1.6.3=py38h27cfd23_0 + - zipp=3.7.0=pyhd3eb1b0_0 + - zlib=1.2.11=h7f8727e_4 + - zstd=1.4.9=haebb681_0 +prefix: /home/robertsc/.conda/envs/py38 diff --git a/pixel-model/layers.py b/pixel_model/layers.py similarity index 100% rename from pixel-model/layers.py rename to pixel_model/layers.py diff --git a/pixel-model/pixelcnn.py b/pixel_model/pixelcnn.py similarity index 98% rename from pixel-model/pixelcnn.py rename to pixel_model/pixelcnn.py index 50312ab..f5c09ce 100644 --- a/pixel-model/pixelcnn.py +++ b/pixel_model/pixelcnn.py @@ -17,10 +17,10 @@ from pytorch_lightning.metrics import Accuracy, Precision, Recall from tqdm import tqdm -from layers import FixupCausalResBlock, PreActFixupCausalResBlock, input_to_stack, stack_to_output, GatedResBlock +from pixel_model.layers import FixupCausalResBlock, PreActFixupCausalResBlock, input_to_stack, stack_to_output, GatedResBlock +from pixel_model.train_helpers import idx_to_one_hot, bits_per_dim, mixup_data, mixup_criterion from utils.logging_helpers import sub_metric_log_dict from utils.argparse_helpers import booltype -from train_helpers import idx_to_one_hot, bits_per_dim, mixup_data, mixup_criterion diff --git a/pixel-model/pixelsnail.py b/pixel_model/pixelsnail.py similarity index 98% rename from pixel-model/pixelsnail.py rename to pixel_model/pixelsnail.py index d190671..0b2bfa9 100644 --- a/pixel-model/pixelsnail.py +++ b/pixel_model/pixelsnail.py @@ -17,10 +17,10 @@ from pytorch_lightning.metrics import Accuracy, Precision, Recall from tqdm import tqdm -from layers import CausalAttentionPixelBlock, PreActFixupCausalResBlock, input_to_stack, stack_to_output, GatedResBlock +from pixel_model.layers import CausalAttentionPixelBlock, PreActFixupCausalResBlock, input_to_stack, stack_to_output, GatedResBlock +from pixel_model.train_helpers import idx_to_one_hot, bits_per_dim, mixup_data, mixup_criterion from utils.logging_helpers import sub_metric_log_dict from utils.argparse_helpers import booltype -from train_helpers import idx_to_one_hot, bits_per_dim, mixup_data, mixup_criterion diff --git a/pixel-model/sample_embeddings.py b/pixel_model/sample_embeddings.py similarity index 98% rename from pixel-model/sample_embeddings.py rename to pixel_model/sample_embeddings.py index 3916c53..5585614 100644 --- a/pixel-model/sample_embeddings.py +++ b/pixel_model/sample_embeddings.py @@ -12,8 +12,8 @@ from tqdm import tqdm from filelock import FileLock -from pixelcnn import PixelCNN -from pixelsnail import PixelSNAIL +from pixel_model.pixelcnn import PixelCNN +from pixel_model.pixelsnail import PixelSNAIL GPU = torch.device('cuda') diff --git a/pixel-model/test.py b/pixel_model/test.py similarity index 95% rename from pixel-model/test.py rename to pixel_model/test.py index dcae7f2..76a5521 100644 --- a/pixel-model/test.py +++ b/pixel_model/test.py @@ -2,7 +2,7 @@ import matplotlib.pyplot as plt from torchvision.utils import make_grid -from model import CausalConv3dAdd +from pixel_model.layers import CausalConv3dAdd if __name__ == '__main__': inp = torch.zeros((1, 3, 20,20,20)) diff --git a/pixel-model/train.py b/pixel_model/train.py similarity index 96% rename from pixel-model/train.py rename to pixel_model/train.py index e158da4..16aa83a 100644 --- a/pixel-model/train.py +++ b/pixel_model/train.py @@ -4,8 +4,8 @@ import torch import pytorch_lightning as pl -from pixelcnn import PixelCNN -from pixelsnail import PixelSNAIL +from pixel_model.pixelcnn import PixelCNN +from pixel_model.pixelsnail import PixelSNAIL from utils.load_lmdb_dataset import LMDBDataModule def parse_arguments(): diff --git a/pixel-model/train_helpers.py b/pixel_model/train_helpers.py similarity index 100% rename from pixel-model/train_helpers.py rename to pixel_model/train_helpers.py diff --git a/vqvae/calc_ssim_from_checkpoint.py b/vqvae/calc_ssim_from_checkpoint.py index c289148..713b77b 100644 --- a/vqvae/calc_ssim_from_checkpoint.py +++ b/vqvae/calc_ssim_from_checkpoint.py @@ -10,7 +10,7 @@ from einops import rearrange import torch.nn as nn -from model import VQVAE +from vqvae.model import VQVAE from utils import CTDataModule from metrics.evaluate import SSIM3DSlices diff --git a/vqvae/decode_embeddings.py b/vqvae/decode_embeddings.py index e461e8e..bbe8c55 100644 --- a/vqvae/decode_embeddings.py +++ b/vqvae/decode_embeddings.py @@ -8,7 +8,7 @@ import torch.nn.functional as F from torch.utils.data import DataLoader -from model import VQVAE +from vqvae.model import VQVAE from utils import CTScanDataset, DepthPadAndCrop def inverse_softplus(x): diff --git a/vqvae/extract_embeddings.py b/vqvae/extract_embeddings.py index a76669b..fc012d1 100644 --- a/vqvae/extract_embeddings.py +++ b/vqvae/extract_embeddings.py @@ -7,7 +7,7 @@ import numpy as np from tqdm import tqdm -from model import VQVAE +from vqvae.model import VQVAE from utils import CTDataModule diff --git a/vqvae/layers.py b/vqvae/layers.py index 46180a9..853af93 100644 --- a/vqvae/layers.py +++ b/vqvae/layers.py @@ -8,7 +8,7 @@ import torch.nn.functional as F from torch import nn -from evonorm import EvoNorm3DS0 +from vqvae.evonorm import EvoNorm3DS0 class EvonormResBlock(nn.Module): diff --git a/vqvae/model.py b/vqvae/model.py index 66b03ba..5f711a1 100644 --- a/vqvae/model.py +++ b/vqvae/model.py @@ -8,7 +8,7 @@ from torch import nn from torch.distributions.normal import Normal -from layers import Encoder, Decoder, FixupResBlock, PreActFixupResBlock, EvonormResBlock, Encoder2 +from vqvae.layers import Encoder, Decoder, FixupResBlock, PreActFixupResBlock, EvonormResBlock, Encoder2 from utils import ExtractCenterCylinder from metrics.distribution import Logistic, mixture_nll_loss, generic_nll_loss from metrics.evaluate import nmse, psnr, SSIM3DSlices diff --git a/vqvae/plot_from_checkpoint.py b/vqvae/plot_from_checkpoint.py index b5a9805..fcbc6c9 100644 --- a/vqvae/plot_from_checkpoint.py +++ b/vqvae/plot_from_checkpoint.py @@ -8,7 +8,7 @@ from torch.utils.data import DataLoader from monai import transforms -from model import VQVAE +from vqvae.model import VQVAE from utils import CTScanDataset, DepthPadAndCrop, CTDataModule diff --git a/vqvae/train.py b/vqvae/train.py index 2d01612..6189810 100644 --- a/vqvae/train.py +++ b/vqvae/train.py @@ -7,7 +7,7 @@ import pytorch_lightning as pl import numpy as np -from model import VQVAE +from vqvae.model import VQVAE from utils import CTDataModule