GANDLF 0.1.3.dev20250318__tar.gz → 0.1.4.dev20250502__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of GANDLF might be problematic. Click here for more details.
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/Dockerfile-CPU +19 -9
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/Dockerfile-CUDA11.8 +19 -10
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/Dockerfile-CUDA12.1 +19 -10
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/Dockerfile-ROCm +18 -10
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/cli/deploy.py +2 -2
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/cli/generate_metrics.py +21 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/cli/main_run.py +4 -12
- gandlf-0.1.4.dev20250502/GANDLF/compute/__init__.py +1 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/compute/forward_pass.py +0 -1
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/compute/generic.py +107 -2
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/compute/inference_loop.py +4 -4
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/compute/loss_and_metric.py +1 -2
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/compute/training_loop.py +10 -10
- gandlf-0.1.4.dev20250502/GANDLF/config_manager.py +69 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/default_config.py +73 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/differential_privacy_config.py +16 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/exclude_parameters.py +1 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/model_config.py +82 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/nested_training_config.py +25 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/optimizer_config.py +121 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/parameters_config.py +10 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/patch_sampler_config.py +11 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/post_processing_config.py +10 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/pre_processing_config.py +94 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/scheduler_config.py +90 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/user_defined_config.py +131 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/utils.py +96 -0
- gandlf-0.1.4.dev20250502/GANDLF/configuration/validators.py +479 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/__init__.py +14 -16
- gandlf-0.1.4.dev20250502/GANDLF/data/lightning_datamodule.py +119 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/run.py +29 -35
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/inference_manager.py +69 -25
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/losses/__init__.py +23 -1
- gandlf-0.1.4.dev20250502/GANDLF/losses/loss_calculators.py +79 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/losses/segmentation.py +3 -2
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/metrics/__init__.py +26 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/metrics/generic.py +1 -1
- gandlf-0.1.4.dev20250502/GANDLF/metrics/metric_calculators.py +102 -0
- gandlf-0.1.4.dev20250502/GANDLF/metrics/panoptica_config_brats.yaml +50 -0
- gandlf-0.1.4.dev20250502/GANDLF/metrics/segmentation_panoptica.py +35 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/__init__.py +8 -3
- gandlf-0.1.4.dev20250502/GANDLF/models/lightning_module.py +2102 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/optimizers/__init__.py +4 -8
- gandlf-0.1.4.dev20250502/GANDLF/privacy/__init__.py +0 -0
- gandlf-0.1.4.dev20250502/GANDLF/privacy/opacus/opacus_anonymization_manager.py +243 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/schedulers/__init__.py +6 -2
- gandlf-0.1.4.dev20250502/GANDLF/training_manager.py +298 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/__init__.py +4 -3
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/imaging.py +121 -2
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/modelio.py +9 -7
- gandlf-0.1.4.dev20250502/GANDLF/utils/pred_target_processors.py +71 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/write_parse.py +1 -1
- gandlf-0.1.4.dev20250502/GANDLF/version.py +1 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF.egg-info/PKG-INFO +14 -8
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF.egg-info/SOURCES.txt +23 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF.egg-info/requires.txt +9 -5
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/PKG-INFO +14 -8
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/setup.py +17 -8
- gandlf-0.1.3.dev20250318/GANDLF/compute/__init__.py +0 -3
- gandlf-0.1.3.dev20250318/GANDLF/config_manager.py +0 -759
- gandlf-0.1.3.dev20250318/GANDLF/training_manager.py +0 -208
- gandlf-0.1.3.dev20250318/GANDLF/version.py +0 -1
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/.dockerignore +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/CODE_OF_CONDUCT.md +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/CONTRIBUTING.md +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/anonymize/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/anonymize/convert_to_nifti.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/cli/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/cli/config_generator.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/cli/data_split_saver.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/cli/huggingface_hub_handler.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/cli/patch_extraction.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/cli/post_training_model_optimization.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/cli/preprocess_and_save.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/cli/recover_config.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/compute/step.py +0 -0
- {gandlf-0.1.3.dev20250318/GANDLF/data/patch_miner/opm → gandlf-0.1.4.dev20250502/GANDLF/configuration}/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/ImagesFromDataFrame.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/augmentation/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/augmentation/blur_enhanced.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/augmentation/hed_augs.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/augmentation/noise_enhanced.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/augmentation/rgb_augs.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/augmentation/rotations.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/augmentation/wrap_torchio.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/inference_dataloader_histopath.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/patch_miner/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318/GANDLF/grad_clipping → gandlf-0.1.4.dev20250502/GANDLF/data/patch_miner/opm}/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/patch_miner/opm/patch.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/patch_miner/opm/patch_manager.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/patch_miner/opm/utils.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/post_process/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/post_process/morphology.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/post_process/tensor.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/crop_zero_planes.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/non_zero_normalize.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/normalize_rgb.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/resample_minimum.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/rgb_conversion.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/template_matching/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/template_matching/base.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/template_matching/histogram_matching.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/template_matching/stain_extractors.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/template_matching/stain_normalizer.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/template_matching/utils.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/data/preprocessing/threshold_and_clip.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/anonymizer.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/cli_tool.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/collect_stats.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/config_generator.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/construct_csv.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/debug_info.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/deploy.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/generate_metrics.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/hf_hub_integration.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/optimize_model.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/patch_miner.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/preprocess.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/recover_config.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/split_csv.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/subcommands.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/entrypoints/verify_install.py +0 -0
- {gandlf-0.1.3.dev20250318/GANDLF/models/seg_modules → gandlf-0.1.4.dev20250502/GANDLF/grad_clipping}/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/grad_clipping/adaptive_gradient_clipping.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/grad_clipping/clip_gradients.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/grad_clipping/grad_scaler.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/logger.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/logging_config.yaml +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/losses/hybrid.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/losses/hybrid_new.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/losses/loss_interface.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/losses/regression.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/losses/regression_new.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/losses/segmentation_new.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/metrics/classification.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/metrics/regression.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/metrics/segmentation.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/metrics/synthesis.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/MSDNet.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/brain_age.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/deep_unet.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/densenet.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/dynunet_wrapper.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/efficientnet.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/fcn.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/imagenet_unet.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/imagenet_vgg.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/light_unet.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/light_unet_multilayer.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/modelBase.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/resnet.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/sdnet.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/DecodingModule.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/DownsamplingModule.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/EncodingModule.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/FCNUpsamplingModule.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/IncConv.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/IncDownsamplingModule.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/IncDropout.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/IncUpsamplingModule.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/InceptionModule.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/InitialConv.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/Interpolate.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/ResNetModule.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/UpsamplingModule.py +0 -0
- {gandlf-0.1.3.dev20250318/GANDLF/privacy → gandlf-0.1.4.dev20250502/GANDLF/models/seg_modules}/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/add_conv_block.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/add_downsample_conv_block.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/average_pool.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/seg_modules/out_conv.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/transunet.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/uinc.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/unet.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/unet_multilayer.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/unetr.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/models/vgg.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/optimizers/thirdparty/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/optimizers/thirdparty/ademamix.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/optimizers/thirdparty/adopt.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/optimizers/thirdparty/lion.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/optimizers/wrap_monai.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/optimizers/wrap_torch.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/parseConfig.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/privacy/opacus/__init__.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/privacy/opacus/config_parsing.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/privacy/opacus/model_handling.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/privacy/opacus/training_utils.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/schedulers/wrap_monai.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/schedulers/wrap_torch.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/data_splitter.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/exceptions.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/gandlf_logging.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/generic.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/handle_collisions.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/modelbase.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/parameter_processing.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF/utils/tensor.py +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF.egg-info/dependency_links.txt +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF.egg-info/entry_points.txt +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF.egg-info/not-zip-safe +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/GANDLF.egg-info/top_level.txt +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/LICENSE +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/MANIFEST.in +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/README.md +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/SECURITY.md +0 -0
- {gandlf-0.1.3.dev20250318 → gandlf-0.1.4.dev20250502}/setup.cfg +0 -0
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
FROM ubuntu:
|
|
1
|
+
FROM ubuntu:22.04
|
|
2
2
|
LABEL github="https://github.com/mlcommons/GaNDLF"
|
|
3
3
|
LABEL docs="https://mlcommons.github.io/GaNDLF/"
|
|
4
4
|
LABEL version=1.0
|
|
5
|
+
# ARG SETUPTOOLS_USE_DISTUTILS=local
|
|
6
|
+
ARG DEBIAN_FRONTEND=noninteractive
|
|
5
7
|
|
|
6
8
|
# Install fresh Python and dependencies for build-from-source
|
|
7
9
|
RUN apt-get update && apt-get install -y software-properties-common
|
|
8
10
|
RUN add-apt-repository ppa:deadsnakes/ppa
|
|
9
|
-
RUN apt
|
|
10
|
-
RUN
|
|
11
|
+
RUN apt install -y python3.11
|
|
12
|
+
RUN apt install -y libpython3.11-dev
|
|
13
|
+
RUN apt install -y libpython3.11
|
|
14
|
+
# RUN apt install -y python-distutils-extra
|
|
15
|
+
RUN apt install -y python3.11-venv
|
|
16
|
+
# RUN apt install -y python-setuptools
|
|
17
|
+
RUN apt install -y python3-pip
|
|
18
|
+
RUN apt-get install -y libjpeg8-dev zlib1g-dev libffi-dev libgl1
|
|
19
|
+
# fix pip version because of weird PyYAML issue
|
|
20
|
+
RUN python3.11 -m pip install --upgrade pip
|
|
11
21
|
# EXPLICITLY install cpu versions of torch/torchvision (not all versions have +cpu modes on PyPI...)
|
|
12
|
-
RUN python3.
|
|
13
|
-
RUN python3.
|
|
22
|
+
RUN python3.11 -m pip install torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cpu
|
|
23
|
+
RUN python3.11 -m pip install openvino-dev opencv-python-headless
|
|
14
24
|
|
|
15
25
|
# Do some dependency installation separately here to make layer caching more efficient
|
|
16
26
|
COPY ./setup.py ./setup.py
|
|
17
|
-
RUN python3.
|
|
18
|
-
|
|
27
|
+
RUN python3.11 -c "from setup import requirements; file = open('requirements.txt', 'w'); file.writelines([req + '\n' for req in requirements]); file.close()" \
|
|
28
|
+
&& python3.11 -m pip install -r ./requirements.txt
|
|
19
29
|
|
|
20
30
|
COPY . /GaNDLF
|
|
21
31
|
WORKDIR /GaNDLF
|
|
22
|
-
RUN python3.
|
|
32
|
+
RUN python3.11 -m pip install -e .
|
|
23
33
|
# Entrypoint forces all commands given via "docker run" to go through python, CMD forces the default entrypoint script argument to be gandlf run
|
|
24
34
|
# If a user calls "docker run gandlf:[tag] anonymize", it will resolve to running "gandlf anonymize" instead.
|
|
25
35
|
# CMD is inherently overridden by args to "docker run", entrypoint is constant.
|
|
@@ -31,7 +41,7 @@ CMD run
|
|
|
31
41
|
# As a side benefit this also decreases the likelihood that users on a cluster won't be able to access their files.
|
|
32
42
|
# See https://github.com/hexops/dockerfile as a best practices guide.
|
|
33
43
|
#RUN addgroup --gid 10001 --system nonroot \
|
|
34
|
-
# && adduser
|
|
44
|
+
# && adduser --uid 10000 --system --ingroup nonroot --home /home/nonroot nonroot
|
|
35
45
|
#
|
|
36
46
|
#USER nonroot
|
|
37
47
|
|
|
@@ -1,28 +1,37 @@
|
|
|
1
|
-
FROM nvidia/cuda:11.8.0-devel-
|
|
1
|
+
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
|
|
2
2
|
LABEL github="https://github.com/mlcommons/GaNDLF"
|
|
3
3
|
LABEL docs="https://mlcommons.github.io/GaNDLF/"
|
|
4
4
|
LABEL version=1.0
|
|
5
|
+
# ARG SETUPTOOLS_USE_DISTUTILS=local
|
|
5
6
|
|
|
6
7
|
# Install instructions for NVIDIA Container Toolkit allowing you to use the host's GPU: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html
|
|
7
8
|
# Note that to do this on a Windows host you need experimental feature "CUDA on WSL" -- not yet stable.
|
|
8
9
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
9
10
|
|
|
10
|
-
# Explicitly install python3.
|
|
11
|
+
# Explicitly install python3.11 (this uses 11.1 for now, as PyTorch LTS 1.8.2 is built against it)
|
|
11
12
|
RUN apt-get update && apt-get install -y software-properties-common
|
|
12
13
|
RUN add-apt-repository ppa:deadsnakes/ppa
|
|
13
|
-
RUN apt
|
|
14
|
-
RUN
|
|
15
|
-
RUN
|
|
16
|
-
RUN
|
|
14
|
+
RUN apt install -y python3.11
|
|
15
|
+
RUN apt install -y libpython3.11-dev
|
|
16
|
+
RUN apt install -y libpython3.11
|
|
17
|
+
# RUN apt install -y python-distutils-extra
|
|
18
|
+
RUN apt install -y python3.11-venv
|
|
19
|
+
# RUN apt install -y python-setuptools
|
|
20
|
+
RUN apt install -y python3-pip
|
|
21
|
+
RUN apt-get install -y libjpeg8-dev zlib1g-dev libffi-dev libgl1
|
|
22
|
+
# fix pip version because of weird PyYAML issue
|
|
23
|
+
RUN python3.11 -m pip install --upgrade pip
|
|
24
|
+
RUN python3.11 -m pip install torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cu118
|
|
25
|
+
RUN python3.11 -m pip install openvino-dev opencv-python-headless
|
|
17
26
|
|
|
18
27
|
# Do some dependency installation separately here to make layer caching more efficient
|
|
19
28
|
COPY ./setup.py ./setup.py
|
|
20
|
-
RUN python3.
|
|
21
|
-
|
|
29
|
+
RUN python3.11 -c "from setup import requirements; file = open('requirements.txt', 'w'); file.writelines([req + '\n' for req in requirements]); file.close()" \
|
|
30
|
+
&& python3.11 -m pip install -r ./requirements.txt
|
|
22
31
|
|
|
23
32
|
COPY . /GaNDLF
|
|
24
33
|
WORKDIR /GaNDLF
|
|
25
|
-
RUN python3.
|
|
34
|
+
RUN python3.11 -m pip install -e .
|
|
26
35
|
|
|
27
36
|
# Entrypoint forces all commands given via "docker run" to go through python, CMD forces the default entrypoint script argument to be gandlf run
|
|
28
37
|
# If a user calls "docker run gandlf:[tag] anonymize", it will resolve to running "gandlf anonymize" instead.
|
|
@@ -35,7 +44,7 @@ CMD run
|
|
|
35
44
|
# As a side benefit this also decreases the likelihood that users on a cluster won't be able to access their files.
|
|
36
45
|
# See https://github.com/hexops/dockerfile as a best practices guide.
|
|
37
46
|
#RUN addgroup --gid 10001 --system nonroot \
|
|
38
|
-
# && adduser
|
|
47
|
+
# && adduser --uid 10000 --system --ingroup nonroot --home /home/nonroot nonroot
|
|
39
48
|
|
|
40
49
|
#USER nonroot
|
|
41
50
|
|
|
@@ -1,28 +1,37 @@
|
|
|
1
|
-
FROM nvidia/cuda:12.1.0-devel-
|
|
1
|
+
FROM nvidia/cuda:12.1.0-devel-ubuntu22.04
|
|
2
2
|
LABEL github="https://github.com/mlcommons/GaNDLF"
|
|
3
3
|
LABEL docs="https://mlcommons.github.io/GaNDLF/"
|
|
4
4
|
LABEL version=1.0
|
|
5
|
+
# ARG SETUPTOOLS_USE_DISTUTILS=local
|
|
5
6
|
|
|
6
7
|
# Install instructions for NVIDIA Container Toolkit allowing you to use the host's GPU: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html
|
|
7
8
|
# Note that to do this on a Windows host you need experimental feature "CUDA on WSL" -- not yet stable.
|
|
8
9
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
9
10
|
|
|
10
|
-
# Explicitly install python3.
|
|
11
|
+
# Explicitly install python3.11 (this uses 11.1 for now, as PyTorch LTS 1.8.2 is built against it)
|
|
11
12
|
RUN apt-get update && apt-get install -y software-properties-common
|
|
12
13
|
RUN add-apt-repository ppa:deadsnakes/ppa
|
|
13
|
-
RUN apt
|
|
14
|
-
RUN
|
|
15
|
-
RUN
|
|
16
|
-
RUN
|
|
14
|
+
RUN apt install -y python3.11
|
|
15
|
+
RUN apt install -y libpython3.11-dev
|
|
16
|
+
RUN apt install -y libpython3.11
|
|
17
|
+
# RUN apt install -y python-distutils-extra
|
|
18
|
+
RUN apt install -y python3.11-venv
|
|
19
|
+
# RUN apt install -y python-setuptools
|
|
20
|
+
RUN apt install -y python3-pip
|
|
21
|
+
RUN apt-get install -y libjpeg8-dev zlib1g-dev libffi-dev libgl1
|
|
22
|
+
# fix pip version because of weird PyYAML issue
|
|
23
|
+
RUN python3.11 -m pip install --upgrade pip
|
|
24
|
+
RUN python3.11 -m pip install torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cu121
|
|
25
|
+
RUN python3.11 -m pip install openvino-dev opencv-python-headless
|
|
17
26
|
|
|
18
27
|
# Do some dependency installation separately here to make layer caching more efficient
|
|
19
28
|
COPY ./setup.py ./setup.py
|
|
20
|
-
RUN python3.
|
|
21
|
-
|
|
29
|
+
RUN python3.11 -c "from setup import requirements; file = open('requirements.txt', 'w'); file.writelines([req + '\n' for req in requirements]); file.close()" \
|
|
30
|
+
&& python3.11 -m pip install -r ./requirements.txt
|
|
22
31
|
|
|
23
32
|
COPY . /GaNDLF
|
|
24
33
|
WORKDIR /GaNDLF
|
|
25
|
-
RUN python3.
|
|
34
|
+
RUN python3.11 -m pip install -e .
|
|
26
35
|
|
|
27
36
|
# Entrypoint forces all commands given via "docker run" to go through python, CMD forces the default entrypoint script argument to be gandlf run
|
|
28
37
|
# If a user calls "docker run gandlf:[tag] anonymize", it will resolve to running "gandlf anonymize" instead.
|
|
@@ -35,7 +44,7 @@ CMD run
|
|
|
35
44
|
# As a side benefit this also decreases the likelihood that users on a cluster won't be able to access their files.
|
|
36
45
|
# See https://github.com/hexops/dockerfile as a best practices guide.
|
|
37
46
|
#RUN addgroup --gid 10001 --system nonroot \
|
|
38
|
-
# && adduser
|
|
47
|
+
# && adduser --uid 10000 --system --ingroup nonroot --home /home/nonroot nonroot
|
|
39
48
|
|
|
40
49
|
#USER nonroot
|
|
41
50
|
|
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
FROM rocm/pytorch:rocm6.
|
|
1
|
+
FROM rocm/pytorch:rocm6.1_ubuntu22.04_py3.10_pytorch_2.4
|
|
2
2
|
LABEL github="https://github.com/mlcommons/GaNDLF"
|
|
3
3
|
LABEL docs="https://mlcommons.github.io/GaNDLF/"
|
|
4
4
|
LABEL version=1.0
|
|
5
|
+
# ARG SETUPTOOLS_USE_DISTUTILS=local
|
|
5
6
|
|
|
6
7
|
# Quick start instructions on using Docker with ROCm: https://github.com/RadeonOpenCompute/ROCm-docker/blob/master/quick-start.md
|
|
7
8
|
|
|
8
9
|
# The base image contains ROCm, python 3.9 and pytorch already, no need to install those
|
|
9
10
|
RUN apt-get update && apt-get install -y software-properties-common
|
|
10
11
|
RUN add-apt-repository ppa:deadsnakes/ppa
|
|
11
|
-
RUN apt
|
|
12
|
-
RUN
|
|
13
|
-
RUN
|
|
14
|
-
RUN
|
|
15
|
-
RUN apt
|
|
12
|
+
RUN apt install -y python3.11
|
|
13
|
+
RUN apt install -y libpython3.11-dev
|
|
14
|
+
RUN apt install -y libpython3.11
|
|
15
|
+
# RUN apt install -y python-distutils-extra
|
|
16
|
+
RUN apt install -y python3.11-venv
|
|
17
|
+
# RUN apt install -y python-setuptools
|
|
18
|
+
RUN apt install -y python3-pip
|
|
19
|
+
RUN apt-get install -y python3.11 python3-pip libjpeg8-dev zlib1g-dev python3-dev libpython3.11-dev libffi-dev libgl1
|
|
20
|
+
# fix pip version because of weird PyYAML issue
|
|
21
|
+
RUN python3.11 -m pip install --upgrade pip
|
|
22
|
+
RUN python3.11 -m pip install torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/rocm6.1
|
|
23
|
+
RUN python3.11 -m pip install openvino-dev opencv-python-headless
|
|
16
24
|
|
|
17
25
|
# Do some dependency installation separately here to make layer caching more efficient
|
|
18
26
|
COPY ./setup.py ./setup.py
|
|
19
|
-
RUN python3.
|
|
20
|
-
|
|
27
|
+
RUN python3.11 -c "from setup import requirements; file = open('requirements.txt', 'w'); file.writelines([req + '\n' for req in requirements]); file.close()" \
|
|
28
|
+
&& python3.11 -m pip install -r ./requirements.txt
|
|
21
29
|
|
|
22
30
|
COPY . /GaNDLF
|
|
23
31
|
WORKDIR /GaNDLF
|
|
24
|
-
RUN python3.
|
|
32
|
+
RUN python3.11 -m pip install -e .
|
|
25
33
|
|
|
26
34
|
# Entrypoint forces all commands given via "docker run" to go through python, CMD forces the default entrypoint script argument to be gandlf run
|
|
27
35
|
# If a user calls "docker run gandlf:[tag] anonymize", it will resolve to running "gandlf anonymize" instead.
|
|
@@ -35,7 +43,7 @@ CMD run
|
|
|
35
43
|
# As a side benefit this also decreases the likelihood that users on a cluster won't be able to access their files.
|
|
36
44
|
# See https://github.com/hexops/dockerfile as a best practices guide.
|
|
37
45
|
#RUN addgroup --gid 10001 --system nonroot \
|
|
38
|
-
# && adduser
|
|
46
|
+
# && adduser --uid 10000 --system --ingroup nonroot --home /home/nonroot nonroot
|
|
39
47
|
#
|
|
40
48
|
#USER nonroot
|
|
41
49
|
|
|
@@ -246,7 +246,7 @@ def get_metrics_mlcube_config(
|
|
|
246
246
|
mlcube_config = yaml.safe_load(f)
|
|
247
247
|
if entrypoint_script:
|
|
248
248
|
# modify the entrypoint to run a custom script
|
|
249
|
-
mlcube_config["tasks"]["evaluate"]["entrypoint"] = "python3.
|
|
249
|
+
mlcube_config["tasks"]["evaluate"]["entrypoint"] = "python3.11 /entrypoint.py"
|
|
250
250
|
mlcube_config["docker"]["build_strategy"] = "auto"
|
|
251
251
|
return mlcube_config
|
|
252
252
|
|
|
@@ -315,7 +315,7 @@ def get_model_mlcube_config(
|
|
|
315
315
|
device = "cuda" if requires_gpu else "cpu"
|
|
316
316
|
mlcube_config["tasks"]["infer"][
|
|
317
317
|
"entrypoint"
|
|
318
|
-
] = f"python3.
|
|
318
|
+
] = f"python3.11 /entrypoint.py --device {device}"
|
|
319
319
|
|
|
320
320
|
return mlcube_config
|
|
321
321
|
# Duplicate training task into one from reset (must be explicit) and one that resumes with new data
|
|
@@ -20,6 +20,7 @@ from GANDLF.metrics import (
|
|
|
20
20
|
mean_squared_log_error,
|
|
21
21
|
mean_absolute_error,
|
|
22
22
|
ncc_metrics,
|
|
23
|
+
generate_instance_segmentation,
|
|
23
24
|
)
|
|
24
25
|
from GANDLF.losses.segmentation import dice
|
|
25
26
|
from GANDLF.metrics.segmentation import (
|
|
@@ -259,6 +260,26 @@ def generate_metrics_dict(
|
|
|
259
260
|
"volumeSimilarity_" + str(class_index)
|
|
260
261
|
] = label_overlap_filter.GetVolumeSimilarity()
|
|
261
262
|
|
|
263
|
+
elif problem_type == "segmentation_brats":
|
|
264
|
+
for _, row in tqdm(input_df.iterrows(), total=input_df.shape[0]):
|
|
265
|
+
current_subject_id = row["SubjectID"]
|
|
266
|
+
overall_stats_dict[current_subject_id] = {}
|
|
267
|
+
label_image = torchio.LabelMap(row["Target"])
|
|
268
|
+
pred_image = torchio.LabelMap(row["Prediction"])
|
|
269
|
+
label_tensor = label_image.data
|
|
270
|
+
pred_tensor = pred_image.data
|
|
271
|
+
spacing = label_image.spacing
|
|
272
|
+
if label_tensor.data.shape[-1] == 1:
|
|
273
|
+
spacing = spacing[0:2]
|
|
274
|
+
# add dimension for batch
|
|
275
|
+
parameters["subject_spacing"] = torch.Tensor(spacing).unsqueeze(0)
|
|
276
|
+
label_array = label_tensor.unsqueeze(0).numpy()
|
|
277
|
+
pred_array = pred_tensor.unsqueeze(0).numpy()
|
|
278
|
+
|
|
279
|
+
overall_stats_dict[current_subject_id] = generate_instance_segmentation(
|
|
280
|
+
prediction=pred_array, target=label_array
|
|
281
|
+
)
|
|
282
|
+
|
|
262
283
|
elif problem_type == "synthesis":
|
|
263
284
|
|
|
264
285
|
def __fix_2d_tensor(input_tensor):
|
|
@@ -16,10 +16,9 @@ def main_run(
|
|
|
16
16
|
config_file: str,
|
|
17
17
|
model_dir: str,
|
|
18
18
|
train_mode: bool,
|
|
19
|
-
device: str,
|
|
20
19
|
resume: bool,
|
|
21
20
|
reset: bool,
|
|
22
|
-
|
|
21
|
+
profile: Optional[bool] = False,
|
|
23
22
|
output_dir: Optional[str] = None,
|
|
24
23
|
) -> None:
|
|
25
24
|
"""
|
|
@@ -30,9 +29,9 @@ def main_run(
|
|
|
30
29
|
config_file (str): The YAML file of the training configuration.
|
|
31
30
|
model_dir (str): The model directory; for training, model is written out here, and for inference, trained model is expected here.
|
|
32
31
|
train_mode (bool): Whether to train or infer.
|
|
33
|
-
device (str): The device type.
|
|
34
32
|
resume (bool): Whether the previous run will be resumed or not.
|
|
35
33
|
reset (bool): Whether the previous run will be reset or not.
|
|
34
|
+
profile (bool): Whether to profile the training or not. Defaults to False.
|
|
36
35
|
output_dir (str): The output directory for the inference session. Defaults to None.
|
|
37
36
|
|
|
38
37
|
Returns:
|
|
@@ -40,9 +39,7 @@ def main_run(
|
|
|
40
39
|
"""
|
|
41
40
|
file_data_full = data_csv
|
|
42
41
|
model_parameters = config_file
|
|
43
|
-
device = device
|
|
44
42
|
parameters = ConfigManager(model_parameters)
|
|
45
|
-
parameters["device_id"] = -1
|
|
46
43
|
|
|
47
44
|
if train_mode:
|
|
48
45
|
if resume:
|
|
@@ -60,9 +57,6 @@ def main_run(
|
|
|
60
57
|
parameters["output_dir"] = model_dir
|
|
61
58
|
Path(parameters["output_dir"]).mkdir(parents=True, exist_ok=True)
|
|
62
59
|
|
|
63
|
-
if "-1" in device:
|
|
64
|
-
device = "cpu"
|
|
65
|
-
|
|
66
60
|
# parse training CSV
|
|
67
61
|
if "," in file_data_full:
|
|
68
62
|
# training and validation pre-split
|
|
@@ -96,10 +90,9 @@ def main_run(
|
|
|
96
90
|
dataframe_testing=data_testing,
|
|
97
91
|
outputDir=parameters["output_dir"],
|
|
98
92
|
parameters=parameters,
|
|
99
|
-
device=device,
|
|
100
93
|
resume=resume,
|
|
101
94
|
reset=reset,
|
|
102
|
-
|
|
95
|
+
profile=profile,
|
|
103
96
|
)
|
|
104
97
|
else:
|
|
105
98
|
data_full, headers = parseTrainingCSV(file_data_full, train=train_mode)
|
|
@@ -109,9 +102,9 @@ def main_run(
|
|
|
109
102
|
dataframe=data_full,
|
|
110
103
|
outputDir=parameters["output_dir"],
|
|
111
104
|
parameters=parameters,
|
|
112
|
-
device=device,
|
|
113
105
|
resume=resume,
|
|
114
106
|
reset=reset,
|
|
107
|
+
profile=profile,
|
|
115
108
|
)
|
|
116
109
|
else:
|
|
117
110
|
_, data_full, headers = parseTestingCSV(
|
|
@@ -122,5 +115,4 @@ def main_run(
|
|
|
122
115
|
modelDir=model_dir,
|
|
123
116
|
outputDir=output_dir,
|
|
124
117
|
parameters=parameters,
|
|
125
|
-
device=device,
|
|
126
118
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .generic import create_pytorch_objects
|
|
@@ -150,7 +150,6 @@ def validate_network(
|
|
|
150
150
|
tensor=subject[key]["data"].squeeze(0),
|
|
151
151
|
affine=subject[key]["affine"].squeeze(0),
|
|
152
152
|
)
|
|
153
|
-
|
|
154
153
|
# regression/classification problem AND label is present
|
|
155
154
|
if (params["problem_type"] != "segmentation") and label_present:
|
|
156
155
|
sampler = torchio.data.LabelSampler(params["patch_size"])
|
|
@@ -2,17 +2,122 @@ from typing import Optional, Tuple
|
|
|
2
2
|
from pandas.util import hash_pandas_object
|
|
3
3
|
import torch
|
|
4
4
|
from torch.utils.data import DataLoader
|
|
5
|
-
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from dataclasses import dataclass
|
|
6
7
|
from GANDLF.models import get_model
|
|
7
8
|
from GANDLF.schedulers import get_scheduler
|
|
8
9
|
from GANDLF.optimizers import get_optimizer
|
|
9
|
-
from GANDLF.data import get_train_loader, get_validation_loader
|
|
10
|
+
from GANDLF.data import get_train_loader, get_validation_loader, ImagesFromDataFrame
|
|
10
11
|
from GANDLF.utils import (
|
|
11
12
|
populate_header_in_parameters,
|
|
13
|
+
populate_channel_keys_in_params,
|
|
12
14
|
parseTrainingCSV,
|
|
13
15
|
send_model_to_device,
|
|
14
16
|
get_class_imbalance_weights,
|
|
15
17
|
)
|
|
18
|
+
from GANDLF.utils.write_parse import get_dataframe
|
|
19
|
+
from torchio import SubjectsDataset, Queue
|
|
20
|
+
from typing import Union
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass
|
|
24
|
+
class AbstractSubsetDataParser(ABC):
|
|
25
|
+
"""
|
|
26
|
+
Interface for subset data parsers, needed to separate the dataset creation
|
|
27
|
+
from construction of the dataloaders.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
subset_csv_path: str
|
|
31
|
+
parameters_dict: dict
|
|
32
|
+
|
|
33
|
+
@abstractmethod
|
|
34
|
+
def create_subset_dataset(self) -> Union[SubjectsDataset, Queue]:
|
|
35
|
+
"""
|
|
36
|
+
Method to create the subset dataset based on the subset CSV file
|
|
37
|
+
and the parameters dict.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
Union[SubjectsDataset, Queue]: The subset dataset.
|
|
41
|
+
"""
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
def get_params_extended_with_subset_data(self) -> dict:
|
|
45
|
+
"""
|
|
46
|
+
Trick to get around the fact that parameters dict need to be modified
|
|
47
|
+
during this parsing procedure. This method should be called after
|
|
48
|
+
create_subset_dataset(), as this method will populate the parameters
|
|
49
|
+
dict with the headers from the subset data.
|
|
50
|
+
"""
|
|
51
|
+
return self.parameters_dict
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class TrainingSubsetDataParser(AbstractSubsetDataParser):
|
|
55
|
+
def create_subset_dataset(self) -> Union[SubjectsDataset, Queue]:
|
|
56
|
+
(
|
|
57
|
+
self.parameters_dict["training_data"],
|
|
58
|
+
headers_to_populate_train,
|
|
59
|
+
) = parseTrainingCSV(self.subset_csv_path, train=True)
|
|
60
|
+
|
|
61
|
+
self.parameters_dict = populate_header_in_parameters(
|
|
62
|
+
self.parameters_dict, headers_to_populate_train
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
(
|
|
66
|
+
self.parameters_dict["penalty_weights"],
|
|
67
|
+
self.parameters_dict["sampling_weights"],
|
|
68
|
+
self.parameters_dict["class_weights"],
|
|
69
|
+
) = get_class_imbalance_weights(
|
|
70
|
+
self.parameters_dict["training_data"], self.parameters_dict
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
print("Penalty weights : ", self.parameters_dict["penalty_weights"])
|
|
74
|
+
print("Sampling weights: ", self.parameters_dict["sampling_weights"])
|
|
75
|
+
print("Class weights : ", self.parameters_dict["class_weights"])
|
|
76
|
+
|
|
77
|
+
return ImagesFromDataFrame(
|
|
78
|
+
get_dataframe(self.parameters_dict["training_data"]),
|
|
79
|
+
self.parameters_dict,
|
|
80
|
+
train=True,
|
|
81
|
+
loader_type="train",
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class ValidationSubsetDataParser(AbstractSubsetDataParser):
|
|
86
|
+
def create_subset_dataset(self) -> Union[SubjectsDataset, Queue]:
|
|
87
|
+
(self.parameters_dict["validation_data"], _) = parseTrainingCSV(
|
|
88
|
+
self.subset_csv_path, train=False
|
|
89
|
+
)
|
|
90
|
+
validation_dataset = ImagesFromDataFrame(
|
|
91
|
+
get_dataframe(self.parameters_dict["validation_data"]),
|
|
92
|
+
self.parameters_dict,
|
|
93
|
+
train=False,
|
|
94
|
+
loader_type="validation",
|
|
95
|
+
)
|
|
96
|
+
self.parameters_dict = populate_channel_keys_in_params(
|
|
97
|
+
validation_dataset, self.parameters_dict
|
|
98
|
+
)
|
|
99
|
+
return validation_dataset
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class TestSubsetDataParser(AbstractSubsetDataParser):
|
|
103
|
+
def create_subset_dataset(self) -> Union[SubjectsDataset, Queue]:
|
|
104
|
+
testing_dataset = ImagesFromDataFrame(
|
|
105
|
+
get_dataframe(self.subset_csv_path),
|
|
106
|
+
self.parameters_dict,
|
|
107
|
+
train=False,
|
|
108
|
+
loader_type="testing",
|
|
109
|
+
)
|
|
110
|
+
if not ("channel_keys" in self.parameters_dict):
|
|
111
|
+
self.parameters_dict = populate_channel_keys_in_params(
|
|
112
|
+
testing_dataset, self.parameters_dict
|
|
113
|
+
)
|
|
114
|
+
return testing_dataset
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class InferenceSubsetDataParserRadiology(TestSubsetDataParser):
|
|
118
|
+
"""Simple wrapper for name coherency, functionally this is the same as TestSubsetDataParser"""
|
|
119
|
+
|
|
120
|
+
pass
|
|
16
121
|
|
|
17
122
|
|
|
18
123
|
def create_pytorch_objects(
|
|
@@ -18,8 +18,8 @@ from torch.cuda.amp import autocast
|
|
|
18
18
|
import openslide
|
|
19
19
|
from GANDLF.data import get_testing_loader
|
|
20
20
|
from GANDLF.utils import (
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
BEST_MODEL_PATH_END,
|
|
22
|
+
LATEST_MODEL_PATH_END,
|
|
23
23
|
load_ov_model,
|
|
24
24
|
print_model_summary,
|
|
25
25
|
applyCustomColorMap,
|
|
@@ -72,11 +72,11 @@ def inference_loop(
|
|
|
72
72
|
files_to_check = [
|
|
73
73
|
os.path.join(
|
|
74
74
|
modelDir,
|
|
75
|
-
str(parameters["model"]["architecture"]) +
|
|
75
|
+
str(parameters["model"]["architecture"]) + BEST_MODEL_PATH_END,
|
|
76
76
|
),
|
|
77
77
|
os.path.join(
|
|
78
78
|
modelDir,
|
|
79
|
-
str(parameters["model"]["architecture"]) +
|
|
79
|
+
str(parameters["model"]["architecture"]) + LATEST_MODEL_PATH_END,
|
|
80
80
|
),
|
|
81
81
|
]
|
|
82
82
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import sys
|
|
2
1
|
import warnings
|
|
3
2
|
from typing import Dict, Tuple, Union
|
|
4
3
|
from GANDLF.losses import global_losses_dict
|
|
@@ -134,7 +133,7 @@ def get_loss_and_metrics(
|
|
|
134
133
|
# Metrics should be a list
|
|
135
134
|
for metric in params["metrics"]:
|
|
136
135
|
metric_lower = metric.lower()
|
|
137
|
-
metric_output[metric] = 0
|
|
136
|
+
metric_output[metric] = 0.0
|
|
138
137
|
if metric_lower not in global_metrics_dict:
|
|
139
138
|
warnings.warn("WARNING: Could not find the requested metric '" + metric)
|
|
140
139
|
continue
|
|
@@ -13,9 +13,9 @@ from GANDLF.grad_clipping.grad_scaler import GradScaler, model_parameters_exclud
|
|
|
13
13
|
from GANDLF.grad_clipping.clip_gradients import dispatch_clip_grad_
|
|
14
14
|
from GANDLF.utils import (
|
|
15
15
|
get_date_time,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
BEST_MODEL_PATH_END,
|
|
17
|
+
LATEST_MODEL_PATH_END,
|
|
18
|
+
INITIAL_MODEL_PATH_END,
|
|
19
19
|
save_model,
|
|
20
20
|
optimize_and_save_model,
|
|
21
21
|
load_model,
|
|
@@ -281,13 +281,13 @@ def training_loop(
|
|
|
281
281
|
first_model_saved = False
|
|
282
282
|
model_paths = {
|
|
283
283
|
"best": os.path.join(
|
|
284
|
-
output_dir, params["model"]["architecture"] +
|
|
284
|
+
output_dir, params["model"]["architecture"] + BEST_MODEL_PATH_END
|
|
285
285
|
),
|
|
286
286
|
"initial": os.path.join(
|
|
287
|
-
output_dir, params["model"]["architecture"] +
|
|
287
|
+
output_dir, params["model"]["architecture"] + INITIAL_MODEL_PATH_END
|
|
288
288
|
),
|
|
289
289
|
"latest": os.path.join(
|
|
290
|
-
output_dir, params["model"]["architecture"] +
|
|
290
|
+
output_dir, params["model"]["architecture"] + LATEST_MODEL_PATH_END
|
|
291
291
|
),
|
|
292
292
|
}
|
|
293
293
|
|
|
@@ -481,14 +481,14 @@ def training_loop(
|
|
|
481
481
|
+ str(mem[3])
|
|
482
482
|
)
|
|
483
483
|
if params["device"] == "cuda":
|
|
484
|
-
|
|
484
|
+
cuda_memory_stats = torch.cuda.memory_stats()
|
|
485
485
|
outputToWrite_mem += (
|
|
486
486
|
","
|
|
487
|
-
+ str(
|
|
487
|
+
+ str(cuda_memory_stats["active.all.peak"])
|
|
488
488
|
+ ","
|
|
489
|
-
+ str(
|
|
489
|
+
+ str(cuda_memory_stats["active.all.current"])
|
|
490
490
|
+ ","
|
|
491
|
-
+ str(
|
|
491
|
+
+ str(cuda_memory_stats["active.all.allocated"])
|
|
492
492
|
)
|
|
493
493
|
outputToWrite_mem += ",\n"
|
|
494
494
|
file_mem.write(outputToWrite_mem)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import traceback
|
|
2
|
+
from typing import Union
|
|
3
|
+
import yaml
|
|
4
|
+
from pydantic import ValidationError
|
|
5
|
+
|
|
6
|
+
from GANDLF.configuration.parameters_config import Parameters
|
|
7
|
+
from GANDLF.configuration.exclude_parameters import exclude_parameters
|
|
8
|
+
from GANDLF.configuration.utils import handle_configuration_errors
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _parseConfig(
|
|
12
|
+
config_file_path: Union[str, dict], version_check_flag: bool = True
|
|
13
|
+
) -> None:
|
|
14
|
+
"""
|
|
15
|
+
This function parses the configuration file and returns a dictionary of parameters.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
config_file_path (Union[str, dict]): The filename of the configuration file.
|
|
19
|
+
version_check_flag (bool, optional): Whether to check the version in configuration file. Defaults to True.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
dict: The parameter dictionary.
|
|
23
|
+
"""
|
|
24
|
+
params = config_file_path
|
|
25
|
+
if not isinstance(config_file_path, dict):
|
|
26
|
+
params = yaml.safe_load(open(config_file_path, "r"))
|
|
27
|
+
|
|
28
|
+
return params
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def ConfigManager(
|
|
32
|
+
config_file_path: Union[str, dict], version_check_flag: bool = True
|
|
33
|
+
) -> dict:
|
|
34
|
+
"""
|
|
35
|
+
This function parses the configuration file and returns a dictionary of parameters.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
config_file_path (Union[str, dict]): The filename of the configuration file.
|
|
39
|
+
version_check_flag (bool, optional): Whether to check the version in configuration file. Defaults to True.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
dict: The parameter dictionary.
|
|
43
|
+
"""
|
|
44
|
+
try:
|
|
45
|
+
parameters_config = Parameters(
|
|
46
|
+
**_parseConfig(config_file_path, version_check_flag)
|
|
47
|
+
)
|
|
48
|
+
parameters = parameters_config.model_dump(
|
|
49
|
+
exclude={
|
|
50
|
+
field
|
|
51
|
+
for field in exclude_parameters
|
|
52
|
+
if getattr(parameters_config, field) is None
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
return parameters
|
|
56
|
+
|
|
57
|
+
except Exception as e:
|
|
58
|
+
if isinstance(e, ValidationError):
|
|
59
|
+
handle_configuration_errors(e)
|
|
60
|
+
raise
|
|
61
|
+
## todo: ensure logging captures assertion errors
|
|
62
|
+
else:
|
|
63
|
+
assert (
|
|
64
|
+
False
|
|
65
|
+
), f"Config parsing failed: {config_file_path=}, {version_check_flag=}, Exception: {str(e)}, {traceback.format_exc()}"
|
|
66
|
+
# logging.error(
|
|
67
|
+
# f"gandlf config parsing failed: {config_file_path=}, {version_check_flag=}, Exception: {str(e)}, {traceback.format_exc()}"
|
|
68
|
+
# )
|
|
69
|
+
# raise
|