Skip to content

Commit

Permalink
Stop mutating input dicts in audio classification pipeline (huggingfa…
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocketknight1 authored Jan 17, 2025
1 parent 936a731 commit 8ad6bd0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/transformers/pipelines/audio_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def preprocess(self, inputs):
inputs = ffmpeg_read(inputs, self.feature_extractor.sampling_rate)

if isinstance(inputs, dict):
inputs = inputs.copy() # So we don't mutate the original dictionary outside the pipeline
# Accepting `"array"` which is the key defined in `datasets` for
# better integration
if not ("sampling_rate" in inputs and ("raw" in inputs or "array" in inputs)):
Expand Down

0 comments on commit 8ad6bd0

Please sign in to comment.