From e24739103f6b1a0f996acc6e01593ea64368fa1b Mon Sep 17 00:00:00 2001 From: Prince Canuma Date: Fri, 20 May 2022 21:32:37 +0200 Subject: [PATCH 1/6] create separate config dict --- neptune_fastai/impl/__init__.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/neptune_fastai/impl/__init__.py b/neptune_fastai/impl/__init__.py index 67e98f7..edc5741 100644 --- a/neptune_fastai/impl/__init__.py +++ b/neptune_fastai/impl/__init__.py @@ -134,14 +134,10 @@ def _target(self) -> str: return 'training' if self.learn.training else 'validation' def _log_model_configuration(self): - self.neptune_run[f'{self.base_namespace}/config'] = { + config = { 'device': self._device, 'batch_size': self._batch_size, 'model': { - 'vocab': { - 'details': self._vocab, - 'total': len(self._vocab) - }, 'params': { 'total': self._total_model_parameters, 'trainable_params': self._trainable_model_parameters, @@ -155,6 +151,8 @@ def _log_model_configuration(self): } } + self.neptune_run[f'{self.base_namespace}/config'] = config + def after_create(self): if not hasattr(self, 'save_model'): if self.upload_saved_models: From 7535868946051158a4e235f029c98467f61354a9 Mon Sep 17 00:00:00 2001 From: Prince Canuma Date: Fri, 20 May 2022 22:02:36 +0200 Subject: [PATCH 2/6] add condition for vocab --- neptune_fastai/impl/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neptune_fastai/impl/__init__.py b/neptune_fastai/impl/__init__.py index edc5741..ea647a3 100644 --- a/neptune_fastai/impl/__init__.py +++ b/neptune_fastai/impl/__init__.py @@ -151,6 +151,12 @@ def _log_model_configuration(self): } } + if hasattr(self.learn.dls, 'vocab'): + config['model']['vocab'] = { + 'details': self._vocab, + 'total': len(self._vocab) + } + self.neptune_run[f'{self.base_namespace}/config'] = config def after_create(self): From 7cdd4757e7b577708229acfc6001116a39fba13f Mon Sep 17 00:00:00 2001 From: Prince Canuma Date: Fri, 20 May 2022 22:12:48 +0200 Subject: [PATCH 3/6] formatting --- neptune_fastai/impl/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neptune_fastai/impl/__init__.py b/neptune_fastai/impl/__init__.py index ea647a3..471eafb 100644 --- a/neptune_fastai/impl/__init__.py +++ b/neptune_fastai/impl/__init__.py @@ -153,9 +153,9 @@ def _log_model_configuration(self): if hasattr(self.learn.dls, 'vocab'): config['model']['vocab'] = { - 'details': self._vocab, - 'total': len(self._vocab) - } + 'details': self._vocab, + 'total': len(self._vocab) + } self.neptune_run[f'{self.base_namespace}/config'] = config From 1287a79e732ff761e65533cba113569b414432b9 Mon Sep 17 00:00:00 2001 From: Siddhant Sadangi Date: Tue, 12 Jul 2022 15:30:51 +0530 Subject: [PATCH 4/6] Minor refactoring --- neptune_fastai/impl/__init__.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/neptune_fastai/impl/__init__.py b/neptune_fastai/impl/__init__.py index 471eafb..203474c 100644 --- a/neptune_fastai/impl/__init__.py +++ b/neptune_fastai/impl/__init__.py @@ -99,7 +99,7 @@ def _total_model_parameters(self) -> int: @property def _trainable_model_parameters(self) -> int: - return sum([p.numel() for p in trainable_params(self.learn)]) + return sum(p.numel() for p in trainable_params(self.learn)) @property def _optimizer_criterion(self) -> str: @@ -160,11 +160,10 @@ def _log_model_configuration(self): self.neptune_run[f'{self.base_namespace}/config'] = config def after_create(self): - if not hasattr(self, 'save_model'): - if self.upload_saved_models: - warnings.warn( - 'NeptuneCallback: SaveModelCallback is necessary for uploading model checkpoints.' - ) + if not hasattr(self, 'save_model') and self.upload_saved_models: + warnings.warn( + 'NeptuneCallback: SaveModelCallback is necessary for uploading model checkpoints.' + ) def before_fit(self): self._log_model_configuration() From 3831c372e88a1c061cc714222146a49b2365ad3e Mon Sep 17 00:00:00 2001 From: Prince Canuma Date: Fri, 15 Jul 2022 15:07:18 +0200 Subject: [PATCH 5/6] update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56e4a6b..a9e6299 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [UNRELEASED] neptune-fastai 0.10.2 + +## Fixes +- Attribute error when loss is not BaseLoss. ([#29](https://github.com/neptune-ai/neptune-fastai/pull/29)) +- Skip vocab for models that don't use it. ([#28](https://github.com/neptune-ai/neptune-fastai/pull/28)) + ## neptune-fastai 0.10.1 ### Features From e5edbce43a06cba099428776b83ad17cfb17449d Mon Sep 17 00:00:00 2001 From: Prince Canuma Date: Fri, 15 Jul 2022 21:32:39 +0200 Subject: [PATCH 6/6] update changelg to original --- CHANGELOG.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9e6299..56e4a6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,3 @@ -## [UNRELEASED] neptune-fastai 0.10.2 - -## Fixes -- Attribute error when loss is not BaseLoss. ([#29](https://github.com/neptune-ai/neptune-fastai/pull/29)) -- Skip vocab for models that don't use it. ([#28](https://github.com/neptune-ai/neptune-fastai/pull/28)) - ## neptune-fastai 0.10.1 ### Features