From 64ab8837dcd9e643ae84f6e112dc923ead211d34 Mon Sep 17 00:00:00 2001 From: HELSON Date: Wed, 4 Jan 2023 03:07:29 +0800 Subject: [PATCH] Fix type error when dividing chunk size in colossalai strategy (#16212) Co-authored-by: awaelchli --- src/pytorch_lightning/CHANGELOG.md | 3 +++ src/pytorch_lightning/strategies/colossalai.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md index 1a0d6c163c..134fe5277e 100644 --- a/src/pytorch_lightning/CHANGELOG.md +++ b/src/pytorch_lightning/CHANGELOG.md @@ -143,6 +143,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Enhanced `reduce_boolean_decision` to accommodate `any`-analogous semantics expected by the `EarlyStopping` callback ([#15253](https://github.com/Lightning-AI/lightning/pull/15253)) +- Fixed a type error when dividing the chunk size in the ColossalAI strategy ([#16212](https://github.com/Lightning-AI/lightning/pull/16212)) + + ## [1.8.6] - 2022-12-21 - minor cleaning diff --git a/src/pytorch_lightning/strategies/colossalai.py b/src/pytorch_lightning/strategies/colossalai.py index ffecc17106..db4d8b01b0 100644 --- a/src/pytorch_lightning/strategies/colossalai.py +++ b/src/pytorch_lightning/strategies/colossalai.py @@ -300,7 +300,8 @@ class ColossalAIStrategy(DDPStrategy): min_chunk_size_mb: float = self.chunk_size_search_kwargs.get( "min_chunk_size", 32 * 1024**2 ) # type: ignore[assignment] - min_chunk_size_mb /= 1024**2 + if min_chunk_size_mb is not None: + min_chunk_size_mb /= 1024**2 model = _LightningModuleWrapperBase(self.model) self.model = GeminiDDP(