Skip to content

Commit 215bb40

Browse files
authored
Fix import if PyTorch is not installed (#715)
* Fix import if PyTorch is not installed. * Style (blank line)
1 parent 5ac1f61 commit 215bb40

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/diffusers/utils/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737
)
3838
from .logging import get_logger
3939
from .outputs import BaseOutput
40-
from .testing_utils import floats_tensor, load_image, parse_flag_from_env, slow, torch_device
40+
41+
42+
if is_torch_available():
43+
from .testing_utils import floats_tensor, load_image, parse_flag_from_env, slow, torch_device
4144

4245

4346
logger = get_logger(__name__)

0 commit comments

Comments
 (0)