We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 62b497c commit c524fd8Copy full SHA for c524fd8
src/diffusers/pipelines/audio_diffusion/mel.py
@@ -23,7 +23,19 @@
23
24
import numpy as np # noqa: E402
25
26
-import librosa # noqa: E402
+
27
+try:
28
+ import librosa # noqa: E402
29
30
+ _librosa_can_be_imported = True
31
+ _import_error = ""
32
+except Exception as e:
33
+ _librosa_can_be_imported = False
34
+ _import_error = (
35
+ f"Cannot import librosa because {e}. Make sure to correctly install librosa to be able to install it."
36
+ )
37
38
39
from PIL import Image # noqa: E402
40
41
@@ -60,6 +72,9 @@ def __init__(
60
72
self.set_resolution(x_res, y_res)
61
73
self.audio = None
62
74
75
+ if not _librosa_can_be_imported:
76
+ raise ValueError(_import_error)
77
63
78
def set_resolution(self, x_res: int, y_res: int):
64
79
"""Set resolution.
65
80
0 commit comments