Skip to content

Commit d4db9d8

Browse files
Guard torch import
1 parent e6eafce commit d4db9d8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/transformers/models/granite_speech/processing_granite_speech.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616

1717
from typing import List, Union
1818

19-
import torch
20-
2119
from transformers.feature_extraction_utils import BatchFeature
2220
from transformers.processing_utils import ProcessorMixin
2321
from transformers.tokenization_utils import PreTokenizedInput, TextInput
24-
from transformers.utils import logging
22+
from transformers.utils import is_torch_available, logging
23+
2524

25+
if is_torch_available():
26+
import torch
2627

2728
logger = logging.get_logger(__name__)
2829

0 commit comments

Comments
 (0)