Skip to content

Commit

Permalink
Enhance flexibility by passing callbacks as method argument (NVIDIA#8015
Browse files Browse the repository at this point in the history
)

* Enhance flexibility by passing callbacks as method argument

Signed-off-by: Michal Futrega <michal.futrega@gmail.com>

* Set callbacks default to None

Signed-off-by: Michal Futrega <michal.futrega@gmail.com>

---------

Signed-off-by: Michal Futrega <michal.futrega@gmail.com>
  • Loading branch information
michal2409 authored Jan 9, 2024
1 parent 4b7f7ea commit 0de93a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nemo/collections/nlp/parts/megatron_trainer_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ def _plugins(self) -> list:

return plugins

def create_trainer(self) -> Trainer:
def create_trainer(self, callbacks=None) -> Trainer:
strategy = self._training_strategy()
plugins = self._plugins()
return Trainer(plugins=plugins, strategy=strategy, **self.cfg.trainer, callbacks=[CustomProgressBar()])
if callbacks is None:
callbacks = [CustomProgressBar()]
return Trainer(plugins=plugins, strategy=strategy, **self.cfg.trainer, callbacks=callbacks)


class MegatronBertTrainerBuilder(MegatronTrainerBuilder):
Expand Down

0 comments on commit 0de93a7

Please sign in to comment.