Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/senselab/audio/tasks/classification/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ def _get_hf_audio_classification_pipeline(
task="audio-classification",
model=model.path_or_uri,
revision=model.revision,
# top_k=top_k, #TODO: this causes a bug in the pipeline that has been reported to transformers
# https://github.com/huggingface/transformers/issues/35736
function_to_apply=function_to_apply, # TODO: parameter ignored in transformer code, bug reported
# https://github.com/huggingface/transformers/issues/35739
top_k=top_k,
function_to_apply=function_to_apply,
Comment on lines +55 to +56

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The batch_size parameter is included in the cache key but is not passed to the pipeline constructor, which means the pipeline will default to a batch size of 1, ignoring the user's preference and potentially impacting performance.

Additionally, please note that when top_k=1, the Hugging Face pipeline returns a single dictionary per input instead of a list of dictionaries. This will cause a TypeError in the post-processing logic at line 158, which expects a list of dictionaries to iterate over.

Suggested change
top_k=top_k,
function_to_apply=function_to_apply,
top_k=top_k,
function_to_apply=function_to_apply,
batch_size=batch_size,

device=device.value,
),
)
Expand Down
Loading