Skip to content

Commit 6d9039f

Browse files
Require torch backend for processor in granite speech
1 parent 31e773d commit 6d9039f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/transformers/models/granite_speech/processing_granite_speech.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from ...processing_utils import ProcessorMixin
2121
from ...tokenization_utils import PreTokenizedInput, TextInput
2222
from ...utils import is_torch_available, logging
23+
from ...utils.import_utils import requires_backends
2324

2425

2526
if is_torch_available():
@@ -48,12 +49,14 @@ def __init__(
4849
def __call__(
4950
self,
5051
text: Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]],
51-
audio: Union[torch.Tensor, List[torch.Tensor]] = None,
52+
audio: Union["torch.Tensor", List["torch.Tensor"]] = None,
5253
device: str = "cpu",
5354
images=None,
5455
videos=None,
5556
**kwargs,
5657
) -> BatchFeature:
58+
requires_backends(self, ["torch"])
59+
5760
text = self._get_validated_text(text)
5861
prompt_strings = text
5962

0 commit comments

Comments
 (0)