From 47d3cec723833343ae3daf9b8d34beef2c856650 Mon Sep 17 00:00:00 2001 From: Daniel King <43149077+dakinggg@users.noreply.github.com> Date: Thu, 24 Oct 2024 17:55:42 -0700 Subject: [PATCH] Don't error if some batch slice has no loss generating tokens (#3682) --- composer/trainer/trainer.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/composer/trainer/trainer.py b/composer/trainer/trainer.py index 3241832c13..f44cb201d8 100644 --- a/composer/trainer/trainer.py +++ b/composer/trainer/trainer.py @@ -3067,13 +3067,6 @@ def _train_microbatches( current_batch_size = sum([ self._train_data_spec.get_num_tokens_in_batch(b, token_type='loss_generating') for b in microbatches ]) - if current_batch_size == 0: - raise ValueError( - textwrap.dedent( - 'Requested loss accumulation based on number of loss generating tokens in training batch, ' - 'but zero tokens found (perhaps due to an improper DataSpec).', - ), - ) else: current_batch_size = sum([self._train_data_spec.get_num_samples_in_batch(b) for b in microbatches]) # Average the current batch size across ranks, to ensure each rank contributes appropriately