Some dependencies appear to be required only for evaluation metrics or plotting, but they are imported globally by modules used during inference.
This makes simple single-file inference fail unless optional packages are installed and pinned correctly.
Examples
ssr_eval
ssr_eval is used for evaluation metrics:
metrics = ssr_eval.metrics.AudioMetrics(rate=self.sampling_rate)
but it is imported globally:
import ssr_eval
This forces users to install ssr_eval even if they only want to run inference and do not need benchmark metrics.
moviepy
plotting_utils.py imports:
from moviepy.video.io.bindings import mplfig_to_npimage
This is required for plotting / logging utilities, but it can break inference if the installed MoviePy version is 2.x.
Suggested improvement
Use lazy imports for optional functionality.
For example:
def compute_eval_metrics(...):
import ssr_eval
...
and:
def plot_spec_to_numpy(...):
from moviepy.video.io.bindings import mplfig_to_npimage
...
This would allow simple inference to run with a smaller dependency set, simplify the installation and have less friction for users who only want audio restoration.
Some dependencies appear to be required only for evaluation metrics or plotting, but they are imported globally by modules used during inference.
This makes simple single-file inference fail unless optional packages are installed and pinned correctly.
Examples
ssr_eval
ssr_evalis used for evaluation metrics:metrics = ssr_eval.metrics.AudioMetrics(rate=self.sampling_rate)but it is imported globally:
import ssr_evalThis forces users to install ssr_eval even if they only want to run inference and do not need benchmark metrics.
moviepy
plotting_utils.pyimports:from moviepy.video.io.bindings import mplfig_to_npimageThis is required for plotting / logging utilities, but it can break inference if the installed MoviePy version is 2.x.
Suggested improvement
Use lazy imports for optional functionality.
For example:
and:
This would allow simple inference to run with a smaller dependency set, simplify the installation and have less friction for users who only want audio restoration.