Skip to content
Merged
Changes from all commits
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: 3 additions & 3 deletions src/senselab/audio/tasks/classification/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ def _get_hf_audio_classification_pipeline(
device, _ = _select_device_and_dtype(
user_preference=device, compatible_devices=[DeviceType.CUDA, DeviceType.CPU]
)
key = f"{model.path_or_uri}-{model.revision}-{top_k}-{function_to_apply}-{device.value}"
# Cache by model identity + device only. top_k, function_to_apply,
# and batch_size are call-time parameters passed at pipe() invocation.
key = f"{model.path_or_uri}-{model.revision}-{device.value}"
Comment on lines +47 to +49

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 comment states that batch_size is a call-time parameter passed at pipe() invocation. However, in classify_audios_with_transformers (line 149), batch_size is not actually passed to the pipeline call, meaning the batch_size argument is currently ignored. Additionally, since top_k, function_to_apply, and batch_size are no longer used to construct the cache key or initialize the pipeline, they are now unused parameters in this method. Consider removing them from the signature of _get_hf_audio_classification_pipeline and updating the caller at line 108.

if key not in cls._pipelines:
cls._pipelines[key] = cast(
Pipeline,
pipeline( # type: ignore[call-overload]
task="audio-classification",
model=model.path_or_uri,
revision=model.revision,
top_k=top_k,
function_to_apply=function_to_apply,
device=device.value,
),
)
Expand Down
Loading