From 1da4da53bbb2800f72aabbd8b61d4ec654401ba3 Mon Sep 17 00:00:00 2001 From: li-li-github Date: Sun, 22 Oct 2023 22:58:10 -0700 Subject: [PATCH 1/2] fixed a bug of counting early stop --- cytoself/trainer/basetrainer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cytoself/trainer/basetrainer.py b/cytoself/trainer/basetrainer.py index c9e1009..d6fbc0f 100644 --- a/cytoself/trainer/basetrainer.py +++ b/cytoself/trainer/basetrainer.py @@ -442,6 +442,7 @@ def fit( self.best_model = deepcopy(self.model) # Save the best model checkpoint self.save_checkpoint() + count_early_stop = 0 else: count_lr_no_improve += 1 count_early_stop += 1 From 1b594ba25f7bf1cebb3004dbfe24360c32442108 Mon Sep 17 00:00:00 2001 From: li-li-github Date: Sun, 22 Oct 2023 23:29:27 -0700 Subject: [PATCH 2/2] fixed a bug of Upsample --- README.md | 16 ++++++---------- .../trainer/autoencoder/decoders/resnet2d.py | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 87fd3ed..4ce9d5a 100644 --- a/README.md +++ b/README.md @@ -44,25 +44,20 @@ information (protein ID) as a label to learn the localization patterns of protei Recommended: create a new environment and install cytoself on the environment from pypi (Optional) To run cytoself on GPUs, it is recommended to install pytorch GPU version before installing cytoself -following the [official instruction](https://pytorch.org/get-started/locally/). +following the [official instruction](https://pytorch.org/get-started/locally/). The way to install pytorch GPU may vary upon your OS and CUDA version. ```shell script conda create -y -n cytoself python=3.9 conda activate cytoself # (Optional: Install pytorch GPU following the official instruction) -pip install cytoself -``` - -### (For the developers) Install from this repository -Make sure you are in the root directory of the repository. - -```bash pip install -e . ``` +### (For the developers) Install from this repository Install development dependencies ```bash pip install -r requirements/development.txt +pre-commit install ``` @@ -184,9 +179,10 @@ fig.show() ## Tested Environments -Rocky Linux 8.6, NVIDIA A100, CUDA 11.7 (GPU) +Rocky Linux 8.6, NVIDIA A100, CUDA 11.7 (GPU)
+Ubuntu 20.04.3 LTS, NVIDIA 3090, CUDA 11.4 (GPU)
+Ubuntu 22.04.3 LTS, NVIDIA 4090, CUDA 12.2 (GPU) -Ubuntu 20.04.3 LTS, NVIDIA 3090, CUDA 11.4 (GPU) ## Data Availability The full data used in this work can be found here. diff --git a/cytoself/trainer/autoencoder/decoders/resnet2d.py b/cytoself/trainer/autoencoder/decoders/resnet2d.py index 91faef7..62d6aa5 100644 --- a/cytoself/trainer/autoencoder/decoders/resnet2d.py +++ b/cytoself/trainer/autoencoder/decoders/resnet2d.py @@ -87,7 +87,7 @@ def __init__( for i in range(num_blocks): if use_upsampling: - target_shape = tuple(np.ceil(output_shape[1:] / (2 ** (num_blocks - (i + 1)))).astype(int)) + target_shape = tuple(np.ceil(output_shape[1:] / (2 ** (num_blocks - (i + 1)))).astype(int).tolist()) self.decoder[f'up{i + 1}'] = nn.Upsample(size=target_shape, mode=sampling_mode, align_corners=False) self.decoder[f'resrep{i+1}'] = ResidualBlockRepeat(