Skip to content

Commit 4cc35bd

Browse files
authored
Merge pull request #501 from sensein/alpha
Merge alpha: pipeline cache key fix
2 parents ae773d5 + 4b6a891 commit 4cc35bd

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/senselab/audio/tasks/classification/huggingface.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ def _get_hf_audio_classification_pipeline(
4444
device, _ = _select_device_and_dtype(
4545
user_preference=device, compatible_devices=[DeviceType.CUDA, DeviceType.CPU]
4646
)
47-
key = f"{model.path_or_uri}-{model.revision}-{top_k}-{function_to_apply}-{device.value}"
47+
# Cache by model identity + device only. top_k, function_to_apply,
48+
# and batch_size are call-time parameters passed at pipe() invocation.
49+
key = f"{model.path_or_uri}-{model.revision}-{device.value}"
4850
if key not in cls._pipelines:
4951
cls._pipelines[key] = cast(
5052
Pipeline,
5153
pipeline( # type: ignore[call-overload]
5254
task="audio-classification",
5355
model=model.path_or_uri,
5456
revision=model.revision,
55-
top_k=top_k,
56-
function_to_apply=function_to_apply,
5757
device=device.value,
5858
),
5959
)

0 commit comments

Comments
 (0)