From 4d067eb96c232f016794699f4e7d68ad17079e83 Mon Sep 17 00:00:00 2001 From: rvasan Date: Mon, 9 Jun 2025 12:09:58 -0700 Subject: [PATCH 01/11] upgrading to latest pytorch --- README.md | 3 +++ cyto_dl/models/basic_model.py | 2 +- cyto_dl/nn/vits/seg.py | 2 +- cyto_dl/utils/checkpoint.py | 2 +- pyproject.toml | 34 +++++++++++++++++----------------- tests/test_mlflow_logger.py | 18 +++++++++++++----- 6 files changed, 36 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index f9c33df83..001c24268 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,9 @@ pip install --no-deps -r requirements/equiv-requirements.txt pip install -e . +#[OPTIONAL] to run tests successfully with torch 2.6 +export TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1 # based on https://github.com/Lightning-AI/pytorch-lightning/issues/20058 + #[OPTIONAL] if you want to use default experiments on example data python scripts/download_test_data.py ``` diff --git a/cyto_dl/models/basic_model.py b/cyto_dl/models/basic_model.py index 52a3834eb..085efb48b 100644 --- a/cyto_dl/models/basic_model.py +++ b/cyto_dl/models/basic_model.py @@ -63,7 +63,7 @@ def __init__( raise ValueError("`network` and `pretrained_weights` can't both be None.") if pretrained_weights is not None: - pretrained_weights = torch.load(pretrained_weights) # nosec B614 + pretrained_weights = torch.load(pretrained_weights, weights_only=False) # nosec B614 if network is not None: self.network = network diff --git a/cyto_dl/nn/vits/seg.py b/cyto_dl/nn/vits/seg.py index 3e10e91a1..41a5ba716 100644 --- a/cyto_dl/nn/vits/seg.py +++ b/cyto_dl/nn/vits/seg.py @@ -221,7 +221,7 @@ def __init__( **encoder_kwargs, ) if encoder_ckpt is not None: - model = torch.load(encoder_ckpt, map_location="cuda:0") # nosec B614 + model = torch.load(encoder_ckpt, map_location="cuda:0", weights_only=False) # nosec B614 enc_state_dict = { k.replace("backbone.encoder.", ""): v for k, v in model["state_dict"].items() diff --git a/cyto_dl/utils/checkpoint.py b/cyto_dl/utils/checkpoint.py index 597251869..662e809b5 100644 --- a/cyto_dl/utils/checkpoint.py +++ b/cyto_dl/utils/checkpoint.py @@ -7,7 +7,7 @@ def load_checkpoint(model, load_params): "ckpt_path" ), "ckpt_path must be provided to with argument weights_only=True" # load model from state dict to get around trainer.max_epochs limit, useful for resuming model training from existing weights - state_dict = torch.load(load_params["ckpt_path"], map_location="cpu")[ + state_dict = torch.load(load_params["ckpt_path"], map_location="cpu", weights_only=False)[ "state_dict" ] # nosec B614 model.load_state_dict(state_dict, strict=load_params.get("strict", True)) diff --git a/pyproject.toml b/pyproject.toml index 01aa14120..aa900fdba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,10 +17,10 @@ authors = [ { name = "Ritvik Vasan", email = "ritvik.vasan@alleninstitute.org" }, ] dependencies = [ - "hydra-core~=1.3.0", + "hydra-core>=1.3.0", "hydra-colorlog>=1.2", "hydra-optuna-sweeper>=1.2", - "torch~=2.0.0", + "torch>=2.0.0", "numpy>=1.23", "matplotlib>=3.7", "pandas>=1.5", @@ -53,20 +53,9 @@ dependencies = [ "opencv-python>=4.10.0", "positional-encodings>=6.0.3", ] -requires-python = ">=3.9,<3.12" +requires-python = ">=3.9,<3.13" [project.optional-dependencies] -equiv = [ - "lie_learn==0.0.1.post1", - "escnn~=1.0.7", - "py3nj>=0.2.1", - "e3nn~=0.5.1" -] -spharm = [ - "vtk~=9.2", - "aicscytoparam~=0.1", - "pyshtools==4.10.3", -] s3 = [ "boto3>=1.23.5,<1.24.5", "s3fs~=2023.1" @@ -85,12 +74,23 @@ pcloud = [ "torchio>=0.19.1", ] all = [ - "cyto-dl[equiv,spharm,s3,torchserve,pcloud]", + "cyto-dl[spharm,s3,torchserve,pcloud]", ] test = [ "cyto-dl", - "pytest~=7.2", - "pytest-cov[toml]~=4.0", + "pytest>=7.2", + "pytest-cov[toml]>=4.0", +] +equiv = [ + "lie_learn==0.0.1.post1", + "escnn~=1.0.7", + "py3nj>=0.2.1", + "e3nn~=0.5.1" +] +spharm = [ + "vtk~=9.2", + "aicscytoparam~=0.1", + "pyshtools==4.10.3", ] docs = [ "cyto-dl", diff --git a/tests/test_mlflow_logger.py b/tests/test_mlflow_logger.py index 1278b2c26..1e8f18adf 100644 --- a/tests/test_mlflow_logger.py +++ b/tests/test_mlflow_logger.py @@ -12,9 +12,9 @@ from cyto_dl.models.utils.mlflow import get_config -@mock.patch("lightning.pytorch.loggers.mlflow._MLFLOW_AVAILABLE", return_value=True) +# @mock.patch("lightning.pytorch.loggers.mlflow._MLFLOW_AVAILABLE", return_value=True) @pytest.mark.parametrize("monitor", [True, False]) -def test_mlflow_log_model(_, tmpdir, monitor): +def test_mlflow_log_model(tmpdir, monitor): """Test that the logger creates the folders and files in the right place.""" max_epochs = 10 @@ -53,7 +53,10 @@ def on_validation_epoch_end(self): local_ckpt_root = os.path.join(tmpdir, "local_ckpt") logger = MLFlowLogger("test", save_dir=mlflow_root, fault_tolerant=False) - + import ipdb + ipdb.set_trace() + print("MLflow tracking URI:", logger._tracking_uri) + print("Run ID:", logger.run_id) if monitor: checkpoint_callback = ModelCheckpoint( dirpath=local_ckpt_root, save_top_k=2, monitor=monitor_key @@ -72,6 +75,11 @@ def on_validation_epoch_end(self): trainer.fit(model) run_folders = [_ for _ in Path(mlflow_root).glob("*") if _.name not in ("0", ".trash")] + + print("Run folders:", run_folders) + print("MLflow root:", mlflow_root) + print("Logger run_id:", logger.run_id) + assert len(run_folders) == 1 run_root = run_folders.pop() @@ -88,8 +96,8 @@ def on_validation_epoch_end(self): assert os.path.isfile(os.path.join(ckpt_folder, "last.ckpt")) -@mock.patch("lightning.pytorch.loggers.mlflow._MLFLOW_AVAILABLE", return_value=True) -def test_mlflow_log_hyperparams(_, tmpdir): +# @mock.patch("lightning.pytorch.loggers.mlflow._MLFLOW_AVAILABLE", return_value=True) +def test_mlflow_log_hyperparams(tmpdir): """Test that the logger creates the folders and files in the right place.""" mlflow_root = os.path.join(tmpdir, "mlflow/") From 04c9eb56441b5c9b90931b533b7cae5ce0127c15 Mon Sep 17 00:00:00 2001 From: rvasan Date: Tue, 10 Jun 2025 13:58:46 -0700 Subject: [PATCH 02/11] remove issues working with zarr v3 --- cyto_dl/dataframe/readers.py | 38 --------- cyto_dl/image/__init__.py | 2 +- cyto_dl/image/io/__init__.py | 1 - cyto_dl/image/io/ome_zarr_reader.py | 56 ------------- cyto_dl/image/transforms/__init__.py | 2 +- cyto_dl/image/transforms/save.py | 120 +++++++++++++-------------- 6 files changed, 62 insertions(+), 157 deletions(-) delete mode 100644 cyto_dl/image/io/ome_zarr_reader.py diff --git a/cyto_dl/dataframe/readers.py b/cyto_dl/dataframe/readers.py index 9f1b54ce5..3ddf54562 100644 --- a/cyto_dl/dataframe/readers.py +++ b/cyto_dl/dataframe/readers.py @@ -9,47 +9,9 @@ import modin.pandas as pd except ModuleNotFoundError: import pandas as pd - -import anndata import pyarrow.parquet -def read_h5ad(path, include_columns=None, backed=None): - """Read an annData object stored in a .h5ad file. - - Parameters - ---------- - - path: Union[Path, str] - Path to the .h5ad file - - include_columns: Optional[Sequence[str]] = None - List of column names and/or regex expressions, used to only include the - desired columns in the resulting dataframe. - - backed: Optional[str] = None - Can be (either "r" or "r+"). - See anndata's docs for details: - https://anndata.readthedocs.io/en/latest/generated/anndata.read_h5ad.html#anndata.read_h5ad - - Returns - ------- - annData - """ - - if backed: - assert backed in ("r", "r+") - dataframe = anndata.read_hda5(path, backed=backed) - - if include_columns is not None: - columns = [] - for filter_ in include_columns: - columns += filter_columns(dataframe.obs.columns.tolist(), regex=filter_) - - dataframe.obs = dataframe.obs[columns] - return dataframe - - def read_parquet(path, include_columns=None): """Read a dataframe stored in a .parquet file, and optionally include only the columns given by `include_columns` diff --git a/cyto_dl/image/__init__.py b/cyto_dl/image/__init__.py index 9a7c6d24f..f281eca1a 100644 --- a/cyto_dl/image/__init__.py +++ b/cyto_dl/image/__init__.py @@ -1,4 +1,4 @@ -from .io import MonaiBioReader, OmeZarrReader +from .io import MonaiBioReader from .transforms import ( BrightSampler, RandomMultiScaleCropd, diff --git a/cyto_dl/image/io/__init__.py b/cyto_dl/image/io/__init__.py index cf20e25cd..d8f9c76e9 100644 --- a/cyto_dl/image/io/__init__.py +++ b/cyto_dl/image/io/__init__.py @@ -1,6 +1,5 @@ from .bioio_loader import BioIOImageLoaderd from .monai_bio_reader import MonaiBioReader from .numpy_reader import ReadNumpyFile -from .ome_zarr_reader import OmeZarrReader from .polygon_loader import PolygonLoaderd from .skimage_reader import SkimageReader diff --git a/cyto_dl/image/io/ome_zarr_reader.py b/cyto_dl/image/io/ome_zarr_reader.py deleted file mode 100644 index 7732120a4..000000000 --- a/cyto_dl/image/io/ome_zarr_reader.py +++ /dev/null @@ -1,56 +0,0 @@ -from typing import Dict, List, Sequence, Tuple, Union - -import numpy as np -from monai.config import PathLike -from monai.data import ImageReader -from monai.data.image_reader import _stack_images -from monai.utils import ensure_tuple, require_pkg -from ome_zarr.io import parse_url -from ome_zarr.reader import Reader -from upath import UPath as Path - - -@require_pkg(pkg_name="upath") -@require_pkg(pkg_name="ome_zarr") -class OmeZarrReader(ImageReader): - def __init__(self, level=0, image_name="default", channels=None): - super().__init__() - self.level = level - self.image_name = image_name - self.channels = channels - - def read(self, data: Union[Sequence[PathLike], PathLike]): - filenames: Sequence[PathLike] = ensure_tuple(data) - img_ = [] - for path in filenames: - if self.image_name: - path = str(Path(path) / self.image_name) - - reader = Reader(parse_url(path)) - node = next(iter(reader())) - img_.append(node) - - return img_ if len(filenames) > 1 else img_[0] - - def get_data(self, img) -> Tuple[np.ndarray, Dict]: - img_array: List[np.ndarray] = [] - - for img_obj in ensure_tuple(img): - data = img_obj.data[self.level].compute()[0] - if self.channels: - _metadata_channels = img_obj.metadata["name"] - _channels = [ - ch if isinstance(ch, int) else _metadata_channels.index(ch) - for ch in self.channels - ] - data = data[_channels] - - img_array.append(data) - - return _stack_images(img_array, {}), {} - - def verify_suffix(self, filename: Union[Sequence[PathLike], PathLike]) -> bool: - for fname in ensure_tuple(filename): - if not str(fname).endswith("zarr"): - return False - return True diff --git a/cyto_dl/image/transforms/__init__.py b/cyto_dl/image/transforms/__init__.py index aa726b68c..6baaba162 100644 --- a/cyto_dl/image/transforms/__init__.py +++ b/cyto_dl/image/transforms/__init__.py @@ -5,7 +5,7 @@ from .multiscale_cropper import RandomMultiScaleCropd from .pad import PadZd from .project import Projectd # codespell:ignore -from .save import Save, Saved +# from .save import Save, Saved try: from .rotation_mask_transform import RotationMask, RotationMaskd diff --git a/cyto_dl/image/transforms/save.py b/cyto_dl/image/transforms/save.py index 54fcbdbe9..b844d5b14 100644 --- a/cyto_dl/image/transforms/save.py +++ b/cyto_dl/image/transforms/save.py @@ -1,68 +1,68 @@ -from pathlib import Path -from typing import Sequence, Union +# from pathlib import Path +# from typing import Sequence, Union -import numpy as np -import torch -from bioio.writers import OmeTiffWriter -from monai.data.meta_tensor import MetaTensor -from monai.transforms import Transform -from omegaconf import ListConfig +# import numpy as np +# import torch +# from bioio.writers import OmeTiffWriter +# from monai.data.meta_tensor import MetaTensor +# from monai.transforms import Transform +# from omegaconf import ListConfig -class Save(Transform): - def __init__( - self, - save_path: str = "./", - ): - """ - Parameters - ---------- - keys: Sequence[str] - keys to save - save_path: str - path to save images - """ - super().__init__() - self.save_path = Path(save_path) - self.count = 0 +# class Save(Transform): +# def __init__( +# self, +# save_path: str = "./", +# ): +# """ +# Parameters +# ---------- +# keys: Sequence[str] +# keys to save +# save_path: str +# path to save images +# """ +# super().__init__() +# self.save_path = Path(save_path) +# self.count = 0 - def __call__(self, img, name="img"): - OmeTiffWriter.save( - uri=self.save_path / f"{name}_{self.count}.tif", - data=img if not isinstance(img, (torch.Tensor, MetaTensor)) else img.numpy(), - ) - self.count += 1 - return img +# def __call__(self, img, name="img"): +# OmeTiffWriter.save( +# uri=self.save_path / f"{name}_{self.count}.tif", +# data=img if not isinstance(img, (torch.Tensor, MetaTensor)) else img.numpy(), +# ) +# self.count += 1 +# return img -class Saved(Transform): - """Save a batch of images to disk for debugging.""" +# class Saved(Transform): +# """Save a batch of images to disk for debugging.""" - def __init__( - self, - keys: Sequence[str], - save_path: str = "./", - allow_missing_keys: bool = False, - ): - """ - Parameters - ---------- - keys: Sequence[str] - keys to save - save_path: str - path to save images - allow_missing_keys: bool - allow missing keys in batch - """ - super().__init__() - self.keys = keys if isinstance(keys, (list, ListConfig)) else [keys] - self.allow_missing_keys = allow_missing_keys - self.saver = Save(save_path) +# def __init__( +# self, +# keys: Sequence[str], +# save_path: str = "./", +# allow_missing_keys: bool = False, +# ): +# """ +# Parameters +# ---------- +# keys: Sequence[str] +# keys to save +# save_path: str +# path to save images +# allow_missing_keys: bool +# allow missing keys in batch +# """ +# super().__init__() +# self.keys = keys if isinstance(keys, (list, ListConfig)) else [keys] +# self.allow_missing_keys = allow_missing_keys +# self.saver = Save(save_path) - def __call__(self, img_dict): - for key in self.keys: - if key in img_dict: - self.saver(img_dict[key], key) - elif not self.allow_missing_keys: - raise ValueError(f"key {key} found in data. Available keys are {img_dict.keys()}") - return img_dict +# def __call__(self, img_dict): +# for key in self.keys: +# if key in img_dict: +# self.saver(img_dict[key], key) +# elif not self.allow_missing_keys: +# raise ValueError(f"key {key} found in data. Available keys are {img_dict.keys()}") +# return img_dict From 4aaca31ed8e840d991952c533f645b71447d72f1 Mon Sep 17 00:00:00 2001 From: rvasan Date: Tue, 10 Jun 2025 15:25:27 -0700 Subject: [PATCH 03/11] revert commit --- README.md | 3 --- cyto_dl/models/basic_model.py | 2 +- cyto_dl/nn/vits/seg.py | 2 +- cyto_dl/utils/checkpoint.py | 2 +- pyproject.toml | 34 +++++++++++++++++----------------- tests/test_mlflow_logger.py | 18 +++++------------- 6 files changed, 25 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 001c24268..f9c33df83 100644 --- a/README.md +++ b/README.md @@ -57,9 +57,6 @@ pip install --no-deps -r requirements/equiv-requirements.txt pip install -e . -#[OPTIONAL] to run tests successfully with torch 2.6 -export TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1 # based on https://github.com/Lightning-AI/pytorch-lightning/issues/20058 - #[OPTIONAL] if you want to use default experiments on example data python scripts/download_test_data.py ``` diff --git a/cyto_dl/models/basic_model.py b/cyto_dl/models/basic_model.py index 085efb48b..52a3834eb 100644 --- a/cyto_dl/models/basic_model.py +++ b/cyto_dl/models/basic_model.py @@ -63,7 +63,7 @@ def __init__( raise ValueError("`network` and `pretrained_weights` can't both be None.") if pretrained_weights is not None: - pretrained_weights = torch.load(pretrained_weights, weights_only=False) # nosec B614 + pretrained_weights = torch.load(pretrained_weights) # nosec B614 if network is not None: self.network = network diff --git a/cyto_dl/nn/vits/seg.py b/cyto_dl/nn/vits/seg.py index 41a5ba716..3e10e91a1 100644 --- a/cyto_dl/nn/vits/seg.py +++ b/cyto_dl/nn/vits/seg.py @@ -221,7 +221,7 @@ def __init__( **encoder_kwargs, ) if encoder_ckpt is not None: - model = torch.load(encoder_ckpt, map_location="cuda:0", weights_only=False) # nosec B614 + model = torch.load(encoder_ckpt, map_location="cuda:0") # nosec B614 enc_state_dict = { k.replace("backbone.encoder.", ""): v for k, v in model["state_dict"].items() diff --git a/cyto_dl/utils/checkpoint.py b/cyto_dl/utils/checkpoint.py index 662e809b5..597251869 100644 --- a/cyto_dl/utils/checkpoint.py +++ b/cyto_dl/utils/checkpoint.py @@ -7,7 +7,7 @@ def load_checkpoint(model, load_params): "ckpt_path" ), "ckpt_path must be provided to with argument weights_only=True" # load model from state dict to get around trainer.max_epochs limit, useful for resuming model training from existing weights - state_dict = torch.load(load_params["ckpt_path"], map_location="cpu", weights_only=False)[ + state_dict = torch.load(load_params["ckpt_path"], map_location="cpu")[ "state_dict" ] # nosec B614 model.load_state_dict(state_dict, strict=load_params.get("strict", True)) diff --git a/pyproject.toml b/pyproject.toml index aa900fdba..01aa14120 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,10 +17,10 @@ authors = [ { name = "Ritvik Vasan", email = "ritvik.vasan@alleninstitute.org" }, ] dependencies = [ - "hydra-core>=1.3.0", + "hydra-core~=1.3.0", "hydra-colorlog>=1.2", "hydra-optuna-sweeper>=1.2", - "torch>=2.0.0", + "torch~=2.0.0", "numpy>=1.23", "matplotlib>=3.7", "pandas>=1.5", @@ -53,9 +53,20 @@ dependencies = [ "opencv-python>=4.10.0", "positional-encodings>=6.0.3", ] -requires-python = ">=3.9,<3.13" +requires-python = ">=3.9,<3.12" [project.optional-dependencies] +equiv = [ + "lie_learn==0.0.1.post1", + "escnn~=1.0.7", + "py3nj>=0.2.1", + "e3nn~=0.5.1" +] +spharm = [ + "vtk~=9.2", + "aicscytoparam~=0.1", + "pyshtools==4.10.3", +] s3 = [ "boto3>=1.23.5,<1.24.5", "s3fs~=2023.1" @@ -74,23 +85,12 @@ pcloud = [ "torchio>=0.19.1", ] all = [ - "cyto-dl[spharm,s3,torchserve,pcloud]", + "cyto-dl[equiv,spharm,s3,torchserve,pcloud]", ] test = [ "cyto-dl", - "pytest>=7.2", - "pytest-cov[toml]>=4.0", -] -equiv = [ - "lie_learn==0.0.1.post1", - "escnn~=1.0.7", - "py3nj>=0.2.1", - "e3nn~=0.5.1" -] -spharm = [ - "vtk~=9.2", - "aicscytoparam~=0.1", - "pyshtools==4.10.3", + "pytest~=7.2", + "pytest-cov[toml]~=4.0", ] docs = [ "cyto-dl", diff --git a/tests/test_mlflow_logger.py b/tests/test_mlflow_logger.py index 1e8f18adf..1278b2c26 100644 --- a/tests/test_mlflow_logger.py +++ b/tests/test_mlflow_logger.py @@ -12,9 +12,9 @@ from cyto_dl.models.utils.mlflow import get_config -# @mock.patch("lightning.pytorch.loggers.mlflow._MLFLOW_AVAILABLE", return_value=True) +@mock.patch("lightning.pytorch.loggers.mlflow._MLFLOW_AVAILABLE", return_value=True) @pytest.mark.parametrize("monitor", [True, False]) -def test_mlflow_log_model(tmpdir, monitor): +def test_mlflow_log_model(_, tmpdir, monitor): """Test that the logger creates the folders and files in the right place.""" max_epochs = 10 @@ -53,10 +53,7 @@ def on_validation_epoch_end(self): local_ckpt_root = os.path.join(tmpdir, "local_ckpt") logger = MLFlowLogger("test", save_dir=mlflow_root, fault_tolerant=False) - import ipdb - ipdb.set_trace() - print("MLflow tracking URI:", logger._tracking_uri) - print("Run ID:", logger.run_id) + if monitor: checkpoint_callback = ModelCheckpoint( dirpath=local_ckpt_root, save_top_k=2, monitor=monitor_key @@ -75,11 +72,6 @@ def on_validation_epoch_end(self): trainer.fit(model) run_folders = [_ for _ in Path(mlflow_root).glob("*") if _.name not in ("0", ".trash")] - - print("Run folders:", run_folders) - print("MLflow root:", mlflow_root) - print("Logger run_id:", logger.run_id) - assert len(run_folders) == 1 run_root = run_folders.pop() @@ -96,8 +88,8 @@ def on_validation_epoch_end(self): assert os.path.isfile(os.path.join(ckpt_folder, "last.ckpt")) -# @mock.patch("lightning.pytorch.loggers.mlflow._MLFLOW_AVAILABLE", return_value=True) -def test_mlflow_log_hyperparams(tmpdir): +@mock.patch("lightning.pytorch.loggers.mlflow._MLFLOW_AVAILABLE", return_value=True) +def test_mlflow_log_hyperparams(_, tmpdir): """Test that the logger creates the folders and files in the right place.""" mlflow_root = os.path.join(tmpdir, "mlflow/") From 9970fb204c402f3b7a2ff064e294676fb8240e92 Mon Sep 17 00:00:00 2001 From: rvasan Date: Tue, 10 Jun 2025 16:43:05 -0700 Subject: [PATCH 04/11] pyproject.toml --- cyto_dl/dataframe/readers.py | 16 ---------------- cyto_dl/models/basic_model.py | 2 +- cyto_dl/nn/vits/seg.py | 2 +- cyto_dl/utils/checkpoint.py | 2 +- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/cyto_dl/dataframe/readers.py b/cyto_dl/dataframe/readers.py index 3ddf54562..2a6290d8e 100644 --- a/cyto_dl/dataframe/readers.py +++ b/cyto_dl/dataframe/readers.py @@ -140,28 +140,12 @@ def read_dataframe( columns += filter_columns(dataframe.columns, regex=filter_) dataframe = dataframe[columns] - elif isinstance(dataframe, anndata.AnnData): - if include_columns is not None: - columns = [] - for filter_ in include_columns: - columns += filter_columns(dataframe.obs.columns, regex=filter_) - - dataframe.obs = dataframe.obs[columns] else: raise TypeError( f"`dataframe` must be either a pd.DataFrame or a path to " f"a file to load one. You passed {type(dataframe)}" ) - if isinstance(dataframe, anndata.AnnData): - # Make dataframe out of anndata object - X = dataframe.X.toarray() - X = pd.DataFrame(X, columns=[f"X_{i}" for i in range(X.shape[1])]).reset_index(drop=True) - index = pd.DataFrame(dataframe.obs_names) - dataframe = dataframe.obs.reset_index(drop=True) - dataframe = pd.concat([X, dataframe], axis=1) - dataframe = pd.concat([index, dataframe], axis=1) - if required_columns is not None: missing_columns = set(required_columns) - set(dataframe.columns) if missing_columns: diff --git a/cyto_dl/models/basic_model.py b/cyto_dl/models/basic_model.py index 52a3834eb..085efb48b 100644 --- a/cyto_dl/models/basic_model.py +++ b/cyto_dl/models/basic_model.py @@ -63,7 +63,7 @@ def __init__( raise ValueError("`network` and `pretrained_weights` can't both be None.") if pretrained_weights is not None: - pretrained_weights = torch.load(pretrained_weights) # nosec B614 + pretrained_weights = torch.load(pretrained_weights, weights_only=False) # nosec B614 if network is not None: self.network = network diff --git a/cyto_dl/nn/vits/seg.py b/cyto_dl/nn/vits/seg.py index 3e10e91a1..41a5ba716 100644 --- a/cyto_dl/nn/vits/seg.py +++ b/cyto_dl/nn/vits/seg.py @@ -221,7 +221,7 @@ def __init__( **encoder_kwargs, ) if encoder_ckpt is not None: - model = torch.load(encoder_ckpt, map_location="cuda:0") # nosec B614 + model = torch.load(encoder_ckpt, map_location="cuda:0", weights_only=False) # nosec B614 enc_state_dict = { k.replace("backbone.encoder.", ""): v for k, v in model["state_dict"].items() diff --git a/cyto_dl/utils/checkpoint.py b/cyto_dl/utils/checkpoint.py index 597251869..662e809b5 100644 --- a/cyto_dl/utils/checkpoint.py +++ b/cyto_dl/utils/checkpoint.py @@ -7,7 +7,7 @@ def load_checkpoint(model, load_params): "ckpt_path" ), "ckpt_path must be provided to with argument weights_only=True" # load model from state dict to get around trainer.max_epochs limit, useful for resuming model training from existing weights - state_dict = torch.load(load_params["ckpt_path"], map_location="cpu")[ + state_dict = torch.load(load_params["ckpt_path"], map_location="cpu", weights_only=False)[ "state_dict" ] # nosec B614 model.load_state_dict(state_dict, strict=load_params.get("strict", True)) From 276090cd60953056c05f64dd472106bbbb87f737 Mon Sep 17 00:00:00 2001 From: rvasan Date: Tue, 10 Jun 2025 16:43:36 -0700 Subject: [PATCH 05/11] fixes for torch>2.0.0 --- pyproject.toml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 01aa14120..4a3e2d1ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,10 +17,10 @@ authors = [ { name = "Ritvik Vasan", email = "ritvik.vasan@alleninstitute.org" }, ] dependencies = [ - "hydra-core~=1.3.0", + "hydra-core>=1.3.0", "hydra-colorlog>=1.2", "hydra-optuna-sweeper>=1.2", - "torch~=2.0.0", + "torch>=2.0.0", "numpy>=1.23", "matplotlib>=3.7", "pandas>=1.5", @@ -33,7 +33,6 @@ dependencies = [ "scikit-learn>=1.2", "universal-pathlib>=0.0", "ome-zarr>=0.6", - "anndata>=0.8", "monai>=1.4", "timm>=0.9.7", "tqdm>=4.64", @@ -53,7 +52,7 @@ dependencies = [ "opencv-python>=4.10.0", "positional-encodings>=6.0.3", ] -requires-python = ">=3.9,<3.12" +requires-python = ">=3.9,<3.13" [project.optional-dependencies] equiv = [ @@ -89,8 +88,8 @@ all = [ ] test = [ "cyto-dl", - "pytest~=7.2", - "pytest-cov[toml]~=4.0", + "pytest>=7.2", + "pytest-cov[toml]>=4.0", ] docs = [ "cyto-dl", From 2d5c9616bdf03d2846bf68d8d5c7d515bd033e14 Mon Sep 17 00:00:00 2001 From: rvasan Date: Thu, 12 Jun 2025 16:46:52 -0700 Subject: [PATCH 06/11] create exp if doesnt exist --- cyto_dl/image/io/bioio_loader.py | 1 + cyto_dl/loggers/mlflow.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cyto_dl/image/io/bioio_loader.py b/cyto_dl/image/io/bioio_loader.py index 340ed5513..153cb503a 100644 --- a/cyto_dl/image/io/bioio_loader.py +++ b/cyto_dl/image/io/bioio_loader.py @@ -84,6 +84,7 @@ def __call__(self, data): if self.resolution_key in data: img.set_resolution_level(data[self.resolution_key]) kwargs = {k: self.split_args(data[k]) for k in self.kwargs_keys if k in data} + if self.dask_load: img = img.get_image_dask_data(**kwargs).compute() else: diff --git a/cyto_dl/loggers/mlflow.py b/cyto_dl/loggers/mlflow.py index 9b2fd2df3..5764a2d35 100644 --- a/cyto_dl/loggers/mlflow.py +++ b/cyto_dl/loggers/mlflow.py @@ -13,7 +13,6 @@ from mlflow.store.artifact.local_artifact_repo import LocalArtifactRepository from mlflow.utils.file_utils import local_file_uri_to_path from omegaconf import OmegaConf - from cyto_dl import utils log = utils.get_pylogger(__name__) @@ -47,7 +46,17 @@ def __init__( self.fault_tolerant = fault_tolerant if tracking_uri is not None: + log.info(f"Setting tracking URI: {tracking_uri}") mlflow.set_tracking_uri(tracking_uri) + + log.info(f"Creating or fetching experiment: {experiment_name}") + try: + mlflow.create_experiment(experiment_name) + except: + pass + mlflow.set_experiment(experiment_name) + + log.info('done setting experiment') @rank_zero_only def log_hyperparams(self, params: Union[Dict[str, Any], Namespace], mode="train") -> None: From da1f367dc76d9636e825d0cb8c3274ad22d5ac0b Mon Sep 17 00:00:00 2001 From: rvasan Date: Thu, 12 Jun 2025 17:13:49 -0700 Subject: [PATCH 07/11] add profiling --- cyto_dl/loggers/mlflow.py | 86 ++++++++++++++++++++++++++++++++++++++- cyto_dl/train.py | 5 +++ 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/cyto_dl/loggers/mlflow.py b/cyto_dl/loggers/mlflow.py index 5764a2d35..e9fec88b9 100644 --- a/cyto_dl/loggers/mlflow.py +++ b/cyto_dl/loggers/mlflow.py @@ -4,7 +4,16 @@ from argparse import Namespace from pathlib import Path from typing import Any, Dict, Optional, Union - +import threading +import time +import psutil +from pynvml import ( + nvmlInit, + nvmlShutdown, + nvmlDeviceGetHandleByIndex, + nvmlDeviceGetMemoryInfo, + NVMLError, +) import mlflow from lightning.pytorch.callbacks import ModelCheckpoint from lightning.pytorch.loggers import MLFlowLogger as _MLFlowLogger @@ -58,6 +67,64 @@ def __init__( log.info('done setting experiment') + def start_system_metrics_logging(self, interval: int = 5): + """ + Starts a background thread that logs CPU, memory, and GPU usage to MLflow every `interval` seconds. + """ + def log_metrics_loop(): + try: + nvmlInit() + handle = nvmlDeviceGetHandleByIndex(0) + except NVMLError: + log.warning("Unable to initialize NVML for GPU monitoring.") + return + + while getattr(threading.current_thread(), "keep_running", True): + cpu = psutil.cpu_percent() + mem = psutil.virtual_memory().percent + + try: + gpu_mem = nvmlDeviceGetMemoryInfo(handle) + gpu_used = gpu_mem.used // (1024 * 1024) # MB + except NVMLError: + gpu_used = 0 + + try: + self.experiment.log_metrics( + self.run_id, + { + "system/cpu_percent": cpu, + "system/mem_percent": mem, + "system/gpu_mem_used_mb": gpu_used, + }, + step=int(time.time()), + ) + except Exception as e: + if self.fault_tolerant: + log.warn(f"[MLFlowLogger] Failed to log system metrics: {e}") + else: + raise e + + time.sleep(interval) + + try: + nvmlShutdown() + except Exception: + pass + + self._sys_metrics_thread = threading.Thread( + target=log_metrics_loop, + daemon=True, + ) + self._sys_metrics_thread.keep_running = True + self._sys_metrics_thread.start() + + def stop_system_metrics_logging(self): + """Stops the system metrics thread cleanly.""" + if hasattr(self, "_sys_metrics_thread"): + self._sys_metrics_thread.keep_running = False + self._sys_metrics_thread.join(timeout=10) + @rank_zero_only def log_hyperparams(self, params: Union[Dict[str, Any], Namespace], mode="train") -> None: requirements = params.pop("requirements", []) @@ -76,6 +143,23 @@ def log_hyperparams(self, params: Union[Dict[str, Any], Namespace], mode="train" self.run_id, local_path=reqs_path, artifact_path="requirements" ) + @rank_zero_only + def log_profiler_artifacts(self, profiler_output_dir: str): + """ + Logs profiler artifacts (e.g., from PyTorchProfiler) to MLflow under the 'profiler' artifact path. + """ + if not os.path.isdir(profiler_output_dir): + log.warn(f"No profiler output found at: {profiler_output_dir}") + return + try: + self.experiment.log_artifacts(self.run_id, local_dir=profiler_output_dir, artifact_path="profiler") + log.info(f"Profiler artifacts logged from {profiler_output_dir}") + except Exception as e: + if self.fault_tolerant: + log.warn(f"Failed to log profiler artifacts: {e}") + else: + raise e + @rank_zero_only def log_metrics(self, metrics, step): try: diff --git a/cyto_dl/train.py b/cyto_dl/train.py index 43ee9bb46..cc05b16a1 100644 --- a/cyto_dl/train.py +++ b/cyto_dl/train.py @@ -104,6 +104,8 @@ def train(cfg: DictConfig, data=None) -> Tuple[dict, dict]: tuner = Tuner(trainer=trainer) tuner.scale_batch_size(model, datamodule=data, mode="power") + logger.start_system_metrics_logging() + if cfg.get("train"): log.info("Starting training!") model, load_params = utils.load_checkpoint(model, cfg.get("checkpoint")) @@ -117,6 +119,9 @@ def train(cfg: DictConfig, data=None) -> Tuple[dict, dict]: ckpt_path=load_params.get("ckpt_path"), ) + logger.stop_system_metrics_logging() + logger = trainer.logger + logger.log_profiler_artifacts(cfg.paths.output_dir + "/profile") train_metrics = trainer.callback_metrics if cfg.get("test"): From ac64b371fa88b59cdb3cf682ceec46b6fede5bda Mon Sep 17 00:00:00 2001 From: rvasan Date: Thu, 12 Jun 2025 17:23:11 -0700 Subject: [PATCH 08/11] add profliling --- cyto_dl/loggers/mlflow.py | 4 ++-- cyto_dl/train.py | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cyto_dl/loggers/mlflow.py b/cyto_dl/loggers/mlflow.py index e9fec88b9..e56acb9f3 100644 --- a/cyto_dl/loggers/mlflow.py +++ b/cyto_dl/loggers/mlflow.py @@ -90,14 +90,14 @@ def log_metrics_loop(): gpu_used = 0 try: - self.experiment.log_metrics( - self.run_id, + mlflow.log_metrics( { "system/cpu_percent": cpu, "system/mem_percent": mem, "system/gpu_mem_used_mb": gpu_used, }, step=int(time.time()), + run_id=self.run_id, ) except Exception as e: if self.fault_tolerant: diff --git a/cyto_dl/train.py b/cyto_dl/train.py index cc05b16a1..0a317d552 100644 --- a/cyto_dl/train.py +++ b/cyto_dl/train.py @@ -10,6 +10,7 @@ import pyrootutils import torch from lightning import Callback, LightningDataModule, LightningModule, Trainer +from lightning.pytorch.loggers import MLFlowLogger from lightning.pytorch.loggers.logger import Logger from lightning.pytorch.tuner import Tuner from omegaconf import DictConfig, OmegaConf @@ -104,7 +105,9 @@ def train(cfg: DictConfig, data=None) -> Tuple[dict, dict]: tuner = Tuner(trainer=trainer) tuner.scale_batch_size(model, datamodule=data, mode="power") - logger.start_system_metrics_logging() + mlflow_logger = next((l for l in logger if isinstance(l, MLFlowLogger)), None) + if mlflow_logger: + mlflow_logger.start_system_metrics_logging() if cfg.get("train"): log.info("Starting training!") @@ -119,7 +122,9 @@ def train(cfg: DictConfig, data=None) -> Tuple[dict, dict]: ckpt_path=load_params.get("ckpt_path"), ) - logger.stop_system_metrics_logging() + if mlflow_logger: + mlflow_logger.stop_system_metrics_logging() + logger = trainer.logger logger.log_profiler_artifacts(cfg.paths.output_dir + "/profile") train_metrics = trainer.callback_metrics From 5cd3640c595961169cbb41401a87f9d75333837d Mon Sep 17 00:00:00 2001 From: benjijamorris <54606172+benjijamorris@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:56:16 -0700 Subject: [PATCH 09/11] add bioio-ome-zarr (#488) * add bioio-ome-zarr * precommit * Update lockfile and requirements files --------- Co-authored-by: Benjamin Morris --- pyproject.toml | 1 + requirements/all-requirements.txt | 17 +++++++ requirements/docs-requirements.txt | 17 +++++++ requirements/equiv-requirements.txt | 17 +++++++ requirements/requirements.txt | 17 +++++++ requirements/spharm-requirements.txt | 17 +++++++ requirements/test-requirements.txt | 17 +++++++ requirements/torchserve-requirements.txt | 17 +++++++ uv.lock | 58 +++++++++++++++++++++++- 9 files changed, 177 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4a3e2d1ba..15675c80c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,7 @@ dependencies = [ "bioio-base!=1.0.5,!=1.0.6", # These versions have issues resolved by 1.0.7, which only supports Python 3.10+ "bioio-czi", "bioio-ome-tiff", + "bioio-ome-zarr", "bioio-tifffile", "tifffile>=2024.0.0,<2025.2.18", "online-stats>=2023", diff --git a/requirements/all-requirements.txt b/requirements/all-requirements.txt index fc81baeb8..06ea17793 100644 --- a/requirements/all-requirements.txt +++ b/requirements/all-requirements.txt @@ -233,6 +233,7 @@ bioio-base==1.0.4 ; python_full_version < '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-base==1.0.7 ; python_full_version >= '3.10' \ @@ -242,6 +243,7 @@ bioio-base==1.0.7 ; python_full_version >= '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-czi==1.0.3 ; python_full_version < '3.10' \ @@ -260,6 +262,14 @@ bioio-ome-tiff==1.1.0 ; python_full_version >= '3.10' \ --hash=sha256:c25b88d77e169c19a275a5b376fcf772315395f7c37b732dc0c19c9190bd0b4d \ --hash=sha256:fa7e5e6a112f5f7613f54281d9702e60d9bf2f95a2f8714f917a8a1e3156350e # via cyto-dl +bioio-ome-zarr==1.1.2 ; python_full_version < '3.10' \ + --hash=sha256:00474ddb0caa3acde3fbef5b5ec75b76b829ee3ef6a399c6c39d73b0d1ff58ce \ + --hash=sha256:3ea86031788bb42076438f7ca8315b3280cc6eae189208e9afd56856d06af850 + # via cyto-dl +bioio-ome-zarr==1.2.0 ; python_full_version >= '3.10' \ + --hash=sha256:dd517effdc9b945813fa82b1a867b9a936dc3ff4706719045bab10ea5179221d \ + --hash=sha256:f4bb66ab89f8e2be5b00fbf0a1dcd7eccad527d5c8820007c94c26287558f9bb + # via cyto-dl bioio-tifffile==1.0.1 ; python_full_version < '3.10' \ --hash=sha256:6d752a765942032bdd6f966f1907ff49616cb25a12ebd7a90a40c300a6a93e4f \ --hash=sha256:710466ee857d4915c4a7c56558f755310471ea41643d161e363a8ffc446d5ec9 @@ -739,6 +749,7 @@ fsspec==2023.3.0 \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # dask # huggingface-hub @@ -1699,12 +1710,14 @@ ome-zarr==0.10.2 ; python_full_version <= '3.10' \ --hash=sha256:9fcc401681708a67c4449d2d085c5d3182bb4d371c34c87b6dc603d485f62df3 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr==0.10.3 ; python_full_version > '3.10' \ --hash=sha256:83f0d7ffb4118a7f4b9cb1a95bc62e873a7c11a1676abd660e7d5154679268b9 \ --hash=sha256:b562b3a1866036df99bf4bf80f0cb38106f464ea65243efce8a18f1e628aa877 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr-models==0.1.5 ; python_full_version >= '3.11' \ --hash=sha256:430be3c54fccefd7605b2ed78bafc363e65b4d444afcc1c0f51963017d0fd745 \ @@ -2933,6 +2946,7 @@ xarray==2024.7.0 ; python_full_version < '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # pyshtools xarray==2025.3.1 ; python_full_version >= '3.10' \ @@ -2942,6 +2956,7 @@ xarray==2025.3.1 ; python_full_version >= '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # pyshtools xmlschema==4.0.1 \ @@ -3017,6 +3032,7 @@ zarr==2.18.2 ; python_full_version < '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr @@ -3026,6 +3042,7 @@ zarr==2.18.3 ; python_full_version >= '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr diff --git a/requirements/docs-requirements.txt b/requirements/docs-requirements.txt index 37fe5fa7a..9b3f9bc19 100644 --- a/requirements/docs-requirements.txt +++ b/requirements/docs-requirements.txt @@ -208,6 +208,7 @@ bioio-base==1.0.4 ; python_full_version < '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-base==1.0.7 ; python_full_version >= '3.10' \ @@ -217,6 +218,7 @@ bioio-base==1.0.7 ; python_full_version >= '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-czi==1.0.3 ; python_full_version < '3.10' \ @@ -235,6 +237,14 @@ bioio-ome-tiff==1.1.0 ; python_full_version >= '3.10' \ --hash=sha256:c25b88d77e169c19a275a5b376fcf772315395f7c37b732dc0c19c9190bd0b4d \ --hash=sha256:fa7e5e6a112f5f7613f54281d9702e60d9bf2f95a2f8714f917a8a1e3156350e # via cyto-dl +bioio-ome-zarr==1.1.2 ; python_full_version < '3.10' \ + --hash=sha256:00474ddb0caa3acde3fbef5b5ec75b76b829ee3ef6a399c6c39d73b0d1ff58ce \ + --hash=sha256:3ea86031788bb42076438f7ca8315b3280cc6eae189208e9afd56856d06af850 + # via cyto-dl +bioio-ome-zarr==1.2.0 ; python_full_version >= '3.10' \ + --hash=sha256:dd517effdc9b945813fa82b1a867b9a936dc3ff4706719045bab10ea5179221d \ + --hash=sha256:f4bb66ab89f8e2be5b00fbf0a1dcd7eccad527d5c8820007c94c26287558f9bb + # via cyto-dl bioio-tifffile==1.0.1 ; python_full_version < '3.10' \ --hash=sha256:6d752a765942032bdd6f966f1907ff49616cb25a12ebd7a90a40c300a6a93e4f \ --hash=sha256:710466ee857d4915c4a7c56558f755310471ea41643d161e363a8ffc446d5ec9 @@ -661,6 +671,7 @@ fsspec==2023.3.0 \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # dask # huggingface-hub @@ -1549,12 +1560,14 @@ ome-zarr==0.10.2 ; python_full_version <= '3.10' \ --hash=sha256:9fcc401681708a67c4449d2d085c5d3182bb4d371c34c87b6dc603d485f62df3 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr==0.10.3 ; python_full_version > '3.10' \ --hash=sha256:83f0d7ffb4118a7f4b9cb1a95bc62e873a7c11a1676abd660e7d5154679268b9 \ --hash=sha256:b562b3a1866036df99bf4bf80f0cb38106f464ea65243efce8a18f1e628aa877 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr-models==0.1.5 ; python_full_version >= '3.11' \ --hash=sha256:430be3c54fccefd7605b2ed78bafc363e65b4d444afcc1c0f51963017d0fd745 \ @@ -2584,6 +2597,7 @@ xarray==2024.7.0 ; python_full_version < '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile xarray==2025.3.1 ; python_full_version >= '3.10' \ --hash=sha256:0252c96a73528b29d1ed7f0ab28d928d2ec00ad809e47369803b184dece1e447 \ @@ -2592,6 +2606,7 @@ xarray==2025.3.1 ; python_full_version >= '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile xmlschema==4.0.1 \ --hash=sha256:9a8598daa2e2859c499f6f08242f7547804ae0c2d037971c44bcb9aae154ff22 \ @@ -2666,6 +2681,7 @@ zarr==2.18.2 ; python_full_version < '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr @@ -2675,6 +2691,7 @@ zarr==2.18.3 ; python_full_version >= '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr diff --git a/requirements/equiv-requirements.txt b/requirements/equiv-requirements.txt index 8812be9c9..21d17e8f0 100644 --- a/requirements/equiv-requirements.txt +++ b/requirements/equiv-requirements.txt @@ -200,6 +200,7 @@ bioio-base==1.0.4 ; python_full_version < '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-base==1.0.7 ; python_full_version >= '3.10' \ @@ -209,6 +210,7 @@ bioio-base==1.0.7 ; python_full_version >= '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-czi==1.0.3 ; python_full_version < '3.10' \ @@ -227,6 +229,14 @@ bioio-ome-tiff==1.1.0 ; python_full_version >= '3.10' \ --hash=sha256:c25b88d77e169c19a275a5b376fcf772315395f7c37b732dc0c19c9190bd0b4d \ --hash=sha256:fa7e5e6a112f5f7613f54281d9702e60d9bf2f95a2f8714f917a8a1e3156350e # via cyto-dl +bioio-ome-zarr==1.1.2 ; python_full_version < '3.10' \ + --hash=sha256:00474ddb0caa3acde3fbef5b5ec75b76b829ee3ef6a399c6c39d73b0d1ff58ce \ + --hash=sha256:3ea86031788bb42076438f7ca8315b3280cc6eae189208e9afd56856d06af850 + # via cyto-dl +bioio-ome-zarr==1.2.0 ; python_full_version >= '3.10' \ + --hash=sha256:dd517effdc9b945813fa82b1a867b9a936dc3ff4706719045bab10ea5179221d \ + --hash=sha256:f4bb66ab89f8e2be5b00fbf0a1dcd7eccad527d5c8820007c94c26287558f9bb + # via cyto-dl bioio-tifffile==1.0.1 ; python_full_version < '3.10' \ --hash=sha256:6d752a765942032bdd6f966f1907ff49616cb25a12ebd7a90a40c300a6a93e4f \ --hash=sha256:710466ee857d4915c4a7c56558f755310471ea41643d161e363a8ffc446d5ec9 @@ -654,6 +664,7 @@ fsspec==2023.3.0 \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # dask # huggingface-hub @@ -1536,12 +1547,14 @@ ome-zarr==0.10.2 ; python_full_version <= '3.10' \ --hash=sha256:9fcc401681708a67c4449d2d085c5d3182bb4d371c34c87b6dc603d485f62df3 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr==0.10.3 ; python_full_version > '3.10' \ --hash=sha256:83f0d7ffb4118a7f4b9cb1a95bc62e873a7c11a1676abd660e7d5154679268b9 \ --hash=sha256:b562b3a1866036df99bf4bf80f0cb38106f464ea65243efce8a18f1e628aa877 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr-models==0.1.5 ; python_full_version >= '3.11' \ --hash=sha256:430be3c54fccefd7605b2ed78bafc363e65b4d444afcc1c0f51963017d0fd745 \ @@ -2554,6 +2567,7 @@ xarray==2024.7.0 ; python_full_version < '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile xarray==2025.3.1 ; python_full_version >= '3.10' \ --hash=sha256:0252c96a73528b29d1ed7f0ab28d928d2ec00ad809e47369803b184dece1e447 \ @@ -2562,6 +2576,7 @@ xarray==2025.3.1 ; python_full_version >= '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile xmlschema==4.0.1 \ --hash=sha256:9a8598daa2e2859c499f6f08242f7547804ae0c2d037971c44bcb9aae154ff22 \ @@ -2636,6 +2651,7 @@ zarr==2.18.2 ; python_full_version < '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr @@ -2645,6 +2661,7 @@ zarr==2.18.3 ; python_full_version >= '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr diff --git a/requirements/requirements.txt b/requirements/requirements.txt index f26223bf8..caefad48e 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -196,6 +196,7 @@ bioio-base==1.0.4 ; python_full_version < '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-base==1.0.7 ; python_full_version >= '3.10' \ @@ -205,6 +206,7 @@ bioio-base==1.0.7 ; python_full_version >= '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-czi==1.0.3 ; python_full_version < '3.10' \ @@ -223,6 +225,14 @@ bioio-ome-tiff==1.1.0 ; python_full_version >= '3.10' \ --hash=sha256:c25b88d77e169c19a275a5b376fcf772315395f7c37b732dc0c19c9190bd0b4d \ --hash=sha256:fa7e5e6a112f5f7613f54281d9702e60d9bf2f95a2f8714f917a8a1e3156350e # via cyto-dl +bioio-ome-zarr==1.1.2 ; python_full_version < '3.10' \ + --hash=sha256:00474ddb0caa3acde3fbef5b5ec75b76b829ee3ef6a399c6c39d73b0d1ff58ce \ + --hash=sha256:3ea86031788bb42076438f7ca8315b3280cc6eae189208e9afd56856d06af850 + # via cyto-dl +bioio-ome-zarr==1.2.0 ; python_full_version >= '3.10' \ + --hash=sha256:dd517effdc9b945813fa82b1a867b9a936dc3ff4706719045bab10ea5179221d \ + --hash=sha256:f4bb66ab89f8e2be5b00fbf0a1dcd7eccad527d5c8820007c94c26287558f9bb + # via cyto-dl bioio-tifffile==1.0.1 ; python_full_version < '3.10' \ --hash=sha256:6d752a765942032bdd6f966f1907ff49616cb25a12ebd7a90a40c300a6a93e4f \ --hash=sha256:710466ee857d4915c4a7c56558f755310471ea41643d161e363a8ffc446d5ec9 @@ -642,6 +652,7 @@ fsspec==2023.3.0 \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # dask # huggingface-hub @@ -1512,12 +1523,14 @@ ome-zarr==0.10.2 ; python_full_version <= '3.10' \ --hash=sha256:9fcc401681708a67c4449d2d085c5d3182bb4d371c34c87b6dc603d485f62df3 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr==0.10.3 ; python_full_version > '3.10' \ --hash=sha256:83f0d7ffb4118a7f4b9cb1a95bc62e873a7c11a1676abd660e7d5154679268b9 \ --hash=sha256:b562b3a1866036df99bf4bf80f0cb38106f464ea65243efce8a18f1e628aa877 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr-models==0.1.5 ; python_full_version >= '3.11' \ --hash=sha256:430be3c54fccefd7605b2ed78bafc363e65b4d444afcc1c0f51963017d0fd745 \ @@ -2498,6 +2511,7 @@ xarray==2024.7.0 ; python_full_version < '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile xarray==2025.3.1 ; python_full_version >= '3.10' \ --hash=sha256:0252c96a73528b29d1ed7f0ab28d928d2ec00ad809e47369803b184dece1e447 \ @@ -2506,6 +2520,7 @@ xarray==2025.3.1 ; python_full_version >= '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile xmlschema==4.0.1 \ --hash=sha256:9a8598daa2e2859c499f6f08242f7547804ae0c2d037971c44bcb9aae154ff22 \ @@ -2580,6 +2595,7 @@ zarr==2.18.2 ; python_full_version < '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr @@ -2589,6 +2605,7 @@ zarr==2.18.3 ; python_full_version >= '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr diff --git a/requirements/spharm-requirements.txt b/requirements/spharm-requirements.txt index 6496bfaf8..cd53035db 100644 --- a/requirements/spharm-requirements.txt +++ b/requirements/spharm-requirements.txt @@ -214,6 +214,7 @@ bioio-base==1.0.4 ; python_full_version < '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-base==1.0.7 ; python_full_version >= '3.10' \ @@ -223,6 +224,7 @@ bioio-base==1.0.7 ; python_full_version >= '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-czi==1.0.3 ; python_full_version < '3.10' \ @@ -241,6 +243,14 @@ bioio-ome-tiff==1.1.0 ; python_full_version >= '3.10' \ --hash=sha256:c25b88d77e169c19a275a5b376fcf772315395f7c37b732dc0c19c9190bd0b4d \ --hash=sha256:fa7e5e6a112f5f7613f54281d9702e60d9bf2f95a2f8714f917a8a1e3156350e # via cyto-dl +bioio-ome-zarr==1.1.2 ; python_full_version < '3.10' \ + --hash=sha256:00474ddb0caa3acde3fbef5b5ec75b76b829ee3ef6a399c6c39d73b0d1ff58ce \ + --hash=sha256:3ea86031788bb42076438f7ca8315b3280cc6eae189208e9afd56856d06af850 + # via cyto-dl +bioio-ome-zarr==1.2.0 ; python_full_version >= '3.10' \ + --hash=sha256:dd517effdc9b945813fa82b1a867b9a936dc3ff4706719045bab10ea5179221d \ + --hash=sha256:f4bb66ab89f8e2be5b00fbf0a1dcd7eccad527d5c8820007c94c26287558f9bb + # via cyto-dl bioio-tifffile==1.0.1 ; python_full_version < '3.10' \ --hash=sha256:6d752a765942032bdd6f966f1907ff49616cb25a12ebd7a90a40c300a6a93e4f \ --hash=sha256:710466ee857d4915c4a7c56558f755310471ea41643d161e363a8ffc446d5ec9 @@ -664,6 +674,7 @@ fsspec==2023.3.0 \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # dask # huggingface-hub @@ -1547,12 +1558,14 @@ ome-zarr==0.10.2 ; python_full_version <= '3.10' \ --hash=sha256:9fcc401681708a67c4449d2d085c5d3182bb4d371c34c87b6dc603d485f62df3 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr==0.10.3 ; python_full_version > '3.10' \ --hash=sha256:83f0d7ffb4118a7f4b9cb1a95bc62e873a7c11a1676abd660e7d5154679268b9 \ --hash=sha256:b562b3a1866036df99bf4bf80f0cb38106f464ea65243efce8a18f1e628aa877 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr-models==0.1.5 ; python_full_version >= '3.11' \ --hash=sha256:430be3c54fccefd7605b2ed78bafc363e65b4d444afcc1c0f51963017d0fd745 \ @@ -2587,6 +2600,7 @@ xarray==2024.7.0 ; python_full_version < '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # pyshtools xarray==2025.3.1 ; python_full_version >= '3.10' \ @@ -2596,6 +2610,7 @@ xarray==2025.3.1 ; python_full_version >= '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # pyshtools xmlschema==4.0.1 \ @@ -2671,6 +2686,7 @@ zarr==2.18.2 ; python_full_version < '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr @@ -2680,6 +2696,7 @@ zarr==2.18.3 ; python_full_version >= '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr diff --git a/requirements/test-requirements.txt b/requirements/test-requirements.txt index 5c9a80f4a..3e57412d5 100644 --- a/requirements/test-requirements.txt +++ b/requirements/test-requirements.txt @@ -196,6 +196,7 @@ bioio-base==1.0.4 ; python_full_version < '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-base==1.0.7 ; python_full_version >= '3.10' \ @@ -205,6 +206,7 @@ bioio-base==1.0.7 ; python_full_version >= '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-czi==1.0.3 ; python_full_version < '3.10' \ @@ -223,6 +225,14 @@ bioio-ome-tiff==1.1.0 ; python_full_version >= '3.10' \ --hash=sha256:c25b88d77e169c19a275a5b376fcf772315395f7c37b732dc0c19c9190bd0b4d \ --hash=sha256:fa7e5e6a112f5f7613f54281d9702e60d9bf2f95a2f8714f917a8a1e3156350e # via cyto-dl +bioio-ome-zarr==1.1.2 ; python_full_version < '3.10' \ + --hash=sha256:00474ddb0caa3acde3fbef5b5ec75b76b829ee3ef6a399c6c39d73b0d1ff58ce \ + --hash=sha256:3ea86031788bb42076438f7ca8315b3280cc6eae189208e9afd56856d06af850 + # via cyto-dl +bioio-ome-zarr==1.2.0 ; python_full_version >= '3.10' \ + --hash=sha256:dd517effdc9b945813fa82b1a867b9a936dc3ff4706719045bab10ea5179221d \ + --hash=sha256:f4bb66ab89f8e2be5b00fbf0a1dcd7eccad527d5c8820007c94c26287558f9bb + # via cyto-dl bioio-tifffile==1.0.1 ; python_full_version < '3.10' \ --hash=sha256:6d752a765942032bdd6f966f1907ff49616cb25a12ebd7a90a40c300a6a93e4f \ --hash=sha256:710466ee857d4915c4a7c56558f755310471ea41643d161e363a8ffc446d5ec9 @@ -679,6 +689,7 @@ fsspec==2023.3.0 \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # dask # huggingface-hub @@ -1553,12 +1564,14 @@ ome-zarr==0.10.2 ; python_full_version <= '3.10' \ --hash=sha256:9fcc401681708a67c4449d2d085c5d3182bb4d371c34c87b6dc603d485f62df3 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr==0.10.3 ; python_full_version > '3.10' \ --hash=sha256:83f0d7ffb4118a7f4b9cb1a95bc62e873a7c11a1676abd660e7d5154679268b9 \ --hash=sha256:b562b3a1866036df99bf4bf80f0cb38106f464ea65243efce8a18f1e628aa877 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr-models==0.1.5 ; python_full_version >= '3.11' \ --hash=sha256:430be3c54fccefd7605b2ed78bafc363e65b4d444afcc1c0f51963017d0fd745 \ @@ -2570,6 +2583,7 @@ xarray==2024.7.0 ; python_full_version < '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile xarray==2025.3.1 ; python_full_version >= '3.10' \ --hash=sha256:0252c96a73528b29d1ed7f0ab28d928d2ec00ad809e47369803b184dece1e447 \ @@ -2578,6 +2592,7 @@ xarray==2025.3.1 ; python_full_version >= '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile xmlschema==4.0.1 \ --hash=sha256:9a8598daa2e2859c499f6f08242f7547804ae0c2d037971c44bcb9aae154ff22 \ @@ -2652,6 +2667,7 @@ zarr==2.18.2 ; python_full_version < '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr @@ -2661,6 +2677,7 @@ zarr==2.18.3 ; python_full_version >= '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr diff --git a/requirements/torchserve-requirements.txt b/requirements/torchserve-requirements.txt index 0ab342df5..c1eee98a9 100644 --- a/requirements/torchserve-requirements.txt +++ b/requirements/torchserve-requirements.txt @@ -196,6 +196,7 @@ bioio-base==1.0.4 ; python_full_version < '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-base==1.0.7 ; python_full_version >= '3.10' \ @@ -205,6 +206,7 @@ bioio-base==1.0.7 ; python_full_version >= '3.10' \ # bioio # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # cyto-dl bioio-czi==1.0.3 ; python_full_version < '3.10' \ @@ -223,6 +225,14 @@ bioio-ome-tiff==1.1.0 ; python_full_version >= '3.10' \ --hash=sha256:c25b88d77e169c19a275a5b376fcf772315395f7c37b732dc0c19c9190bd0b4d \ --hash=sha256:fa7e5e6a112f5f7613f54281d9702e60d9bf2f95a2f8714f917a8a1e3156350e # via cyto-dl +bioio-ome-zarr==1.1.2 ; python_full_version < '3.10' \ + --hash=sha256:00474ddb0caa3acde3fbef5b5ec75b76b829ee3ef6a399c6c39d73b0d1ff58ce \ + --hash=sha256:3ea86031788bb42076438f7ca8315b3280cc6eae189208e9afd56856d06af850 + # via cyto-dl +bioio-ome-zarr==1.2.0 ; python_full_version >= '3.10' \ + --hash=sha256:dd517effdc9b945813fa82b1a867b9a936dc3ff4706719045bab10ea5179221d \ + --hash=sha256:f4bb66ab89f8e2be5b00fbf0a1dcd7eccad527d5c8820007c94c26287558f9bb + # via cyto-dl bioio-tifffile==1.0.1 ; python_full_version < '3.10' \ --hash=sha256:6d752a765942032bdd6f966f1907ff49616cb25a12ebd7a90a40c300a6a93e4f \ --hash=sha256:710466ee857d4915c4a7c56558f755310471ea41643d161e363a8ffc446d5ec9 @@ -642,6 +652,7 @@ fsspec==2023.3.0 \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # dask # huggingface-hub @@ -1516,12 +1527,14 @@ ome-zarr==0.10.2 ; python_full_version <= '3.10' \ --hash=sha256:9fcc401681708a67c4449d2d085c5d3182bb4d371c34c87b6dc603d485f62df3 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr==0.10.3 ; python_full_version > '3.10' \ --hash=sha256:83f0d7ffb4118a7f4b9cb1a95bc62e873a7c11a1676abd660e7d5154679268b9 \ --hash=sha256:b562b3a1866036df99bf4bf80f0cb38106f464ea65243efce8a18f1e628aa877 # via # bioio + # bioio-ome-zarr # cyto-dl ome-zarr-models==0.1.5 ; python_full_version >= '3.11' \ --hash=sha256:430be3c54fccefd7605b2ed78bafc363e65b4d444afcc1c0f51963017d0fd745 \ @@ -2509,6 +2522,7 @@ xarray==2024.7.0 ; python_full_version < '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile xarray==2025.3.1 ; python_full_version >= '3.10' \ --hash=sha256:0252c96a73528b29d1ed7f0ab28d928d2ec00ad809e47369803b184dece1e447 \ @@ -2517,6 +2531,7 @@ xarray==2025.3.1 ; python_full_version >= '3.10' \ # bioio-base # bioio-czi # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile xmlschema==4.0.1 \ --hash=sha256:9a8598daa2e2859c499f6f08242f7547804ae0c2d037971c44bcb9aae154ff22 \ @@ -2591,6 +2606,7 @@ zarr==2.18.2 ; python_full_version < '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr @@ -2600,6 +2616,7 @@ zarr==2.18.3 ; python_full_version >= '3.10' \ # via # bioio # bioio-ome-tiff + # bioio-ome-zarr # bioio-tifffile # ngff-zarr # ome-zarr diff --git a/uv.lock b/uv.lock index 577cc43b5..49febe017 100644 --- a/uv.lock +++ b/uv.lock @@ -746,6 +746,59 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/43/27/a8be335ce5a996f6efc3f1fbf1b468a05de6eadc5ed521ff10d039878609/bioio_ome_tiff-1.1.0-py3-none-any.whl", hash = "sha256:fa7e5e6a112f5f7613f54281d9702e60d9bf2f95a2f8714f917a8a1e3156350e", size = 24969 }, ] +[[package]] +name = "bioio-ome-zarr" +version = "1.1.2" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.10' and platform_machine == 'arm64' and sys_platform == 'darwin'", + "python_full_version < '3.10' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version < '3.10' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.10' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.10' and sys_platform != 'darwin' and sys_platform != 'linux' and sys_platform != 'win32')", + "python_full_version < '3.10' and sys_platform == 'win32'", +] +dependencies = [ + { name = "bioio-base", version = "1.0.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, + { name = "fsspec", marker = "python_full_version < '3.10'" }, + { name = "ome-zarr", version = "0.10.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, + { name = "xarray", version = "2024.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, + { name = "zarr", version = "2.18.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b4/88/4a3e0d67d17b9d36d8c3829299610bb8fde1d840dca35c11d602d3b6e112/bioio_ome_zarr-1.1.2.tar.gz", hash = "sha256:00474ddb0caa3acde3fbef5b5ec75b76b829ee3ef6a399c6c39d73b0d1ff58ce", size = 20558 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c6/a7/03b58f08ab1c6b2fe9ebcfe10298e29354355a6e4f6c6444edcedcf3f1b0/bioio_ome_zarr-1.1.2-py3-none-any.whl", hash = "sha256:3ea86031788bb42076438f7ca8315b3280cc6eae189208e9afd56856d06af850", size = 14906 }, +] + +[[package]] +name = "bioio-ome-zarr" +version = "1.2.0" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.11' and sys_platform == 'darwin'", + "python_full_version >= '3.11' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version >= '3.11' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.11' and sys_platform != 'darwin' and sys_platform != 'linux' and sys_platform != 'win32')", + "python_full_version >= '3.11' and sys_platform == 'win32'", + "python_full_version > '3.10' and python_full_version < '3.11' and sys_platform == 'darwin'", + "python_full_version > '3.10' and python_full_version < '3.11' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version > '3.10' and python_full_version < '3.11' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version > '3.10' and python_full_version < '3.11' and sys_platform != 'darwin' and sys_platform != 'linux' and sys_platform != 'win32')", + "python_full_version == '3.10' and sys_platform == 'darwin'", + "python_full_version == '3.10' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version == '3.10' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10' and sys_platform != 'darwin' and sys_platform != 'linux' and sys_platform != 'win32')", + "python_full_version > '3.10' and python_full_version < '3.11' and sys_platform == 'win32'", + "python_full_version == '3.10' and sys_platform == 'win32'", +] +dependencies = [ + { name = "bioio-base", version = "1.0.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, + { name = "fsspec", marker = "python_full_version >= '3.10'" }, + { name = "ome-zarr", version = "0.10.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10'" }, + { name = "ome-zarr", version = "0.10.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version > '3.10'" }, + { name = "xarray", version = "2025.3.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, + { name = "zarr", version = "2.18.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/75/d1/0aa2c85cc2fb3d9546d5ebcc55a5b10f8c3f3a981dc372da7e40fdc0fc24/bioio_ome_zarr-1.2.0.tar.gz", hash = "sha256:dd517effdc9b945813fa82b1a867b9a936dc3ff4706719045bab10ea5179221d", size = 20567 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/10/38/ffac4900f8bd945a434c3f692b94f3ae250c59b6d58f5bcefdbcd76f6d7c/bioio_ome_zarr-1.2.0-py3-none-any.whl", hash = "sha256:f4bb66ab89f8e2be5b00fbf0a1dcd7eccad527d5c8820007c94c26287558f9bb", size = 14906 }, +] + [[package]] name = "bioio-tifffile" version = "1.0.1" @@ -1179,7 +1232,7 @@ wheels = [ [[package]] name = "cyto-dl" -version = "0.5.1" +version = "0.6.1" source = { editable = "." } dependencies = [ { name = "anndata", version = "0.10.9", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, @@ -1194,6 +1247,8 @@ dependencies = [ { name = "bioio-czi", version = "2.1.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "bioio-ome-tiff", version = "1.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "bioio-ome-tiff", version = "1.1.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, + { name = "bioio-ome-zarr", version = "1.1.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, + { name = "bioio-ome-zarr", version = "1.2.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "bioio-tifffile", version = "1.0.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "bioio-tifffile", version = "1.1.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "boto3" }, @@ -1298,6 +1353,7 @@ requires-dist = [ { name = "bioio-base", specifier = "!=1.0.5,!=1.0.6" }, { name = "bioio-czi" }, { name = "bioio-ome-tiff" }, + { name = "bioio-ome-zarr" }, { name = "bioio-tifffile" }, { name = "boto3" }, { name = "boto3", marker = "extra == 's3'", specifier = ">=1.23.5,<1.24.5" }, From a1fc42c610275c59b777bf6f5b2dc66490cab04c Mon Sep 17 00:00:00 2001 From: benjijamorris <54606172+benjijamorris@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:56:35 -0700 Subject: [PATCH 10/11] remove tracking uri for mlflow logger (#489) Co-authored-by: Benjamin Morris --- configs/logger/mlflow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/logger/mlflow.yaml b/configs/logger/mlflow.yaml index ab1a50b8d..f01d6f91d 100644 --- a/configs/logger/mlflow.yaml +++ b/configs/logger/mlflow.yaml @@ -1,5 +1,5 @@ mlflow: _target_: cyto_dl.loggers.MLFlowLogger - tracking_uri: https://mlflow.a100.int.allencell.org/ + tracking_uri: experiment_name: ${experiment_name} run_name: ${run_name} From 0cac179dd23ae55e8700b5fc57a8da5912c4978e Mon Sep 17 00:00:00 2001 From: benjijamorris <54606172+benjijamorris@users.noreply.github.com> Date: Thu, 12 Jun 2025 09:32:10 -0700 Subject: [PATCH 11/11] save last ckpt, use torchvision wrapper (#490) Co-authored-by: Benjamin Morris --- configs/experiment/im2im/diffae.yaml | 2 ++ configs/model/im2im/diffae.yaml | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configs/experiment/im2im/diffae.yaml b/configs/experiment/im2im/diffae.yaml index 56cbd8b39..750b054d1 100644 --- a/configs/experiment/im2im/diffae.yaml +++ b/configs/experiment/im2im/diffae.yaml @@ -47,3 +47,5 @@ callbacks: num_pcs: 4 n_steps: 3 every_n_epoch: ${model.save_images_every_n_epochs} + model_checkpoint: + monitor: null diff --git a/configs/model/im2im/diffae.yaml b/configs/model/im2im/diffae.yaml index 4edf23932..8df1d4268 100644 --- a/configs/model/im2im/diffae.yaml +++ b/configs/model/im2im/diffae.yaml @@ -24,11 +24,10 @@ loss: reduction: none semantic_encoder: - _target_: cyto_dl.nn.resnet.ResNet - out_dim: 8 + _target_: cyto_dl.nn.TorchVisionWrapper base_encoder: - _partial_: True _target_: torchvision.models.resnet18 + num_classes: 8 # 3D # _target_: monai.networks.nets.Regressor