Skip to content

Commit

Permalink
chore: linting and removing generic exception block Signed-off-by: Au…
Browse files Browse the repository at this point in the history
…thor Name [email protected]

Signed-off-by: eshwarprasadS <[email protected]>
  • Loading branch information
eshwarprasadS committed Jan 14, 2025
1 parent 3d1560e commit 31fa4ba
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/instructlab/sdg/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ def generate(self, dataset, checkpoint_name=None) -> Dataset:
max_workers=self.ctx.batch_num_workers, # Upper limit from config
initial_workers=self.ctx.batch_num_workers//2, # Start at 50% of max
)

if not input_splits:
logger.warning("Input splits are empty. Returning empty dataset.")
return concatenate_datasets([])
return concatenate_datasets([])

while input_splits:
# Get the current number of workers from the throttler
current_workers = throttler.get_workers()
Expand All @@ -205,7 +205,7 @@ def generate(self, dataset, checkpoint_name=None) -> Dataset:
output_splits.append(ds) # Store the successful result
checkpointer.checkpoint(ds) # Save progress
throttler.adjust_workers(success=True) # Increase workers on success

except PipelineBlockError as err:
root_exception = err.exception # Access the underlying exception

Expand All @@ -217,11 +217,8 @@ def generate(self, dataset, checkpoint_name=None) -> Dataset:
# Non-retryable errors
logger.error("Non Retryable error in pipeline batch generation: %s", err)
throttler.adjust_workers(success=False)
except Exception as generic_err:
logger.error("Unexpected error in batch generation: %s", generic_err)
throttler.adjust_workers(success=False) # Adjust workers for unexpected errors


checkpointer.done()
if pre_generated_data:
output_splits.append(pre_generated_data)
Expand Down

0 comments on commit 31fa4ba

Please sign in to comment.