Make torchaudio not a hard requirement. (#7987)

Some platforms can't install it apparently so if it's not there it should
only break models that actually use it.
This commit is contained in:
comfyanonymous 2025-05-07 18:37:12 -07:00 committed by GitHub
parent 56b6ee6754
commit fd08e39588
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -1,7 +1,12 @@
# Original from: https://github.com/ace-step/ACE-Step/blob/main/music_dcae/music_dcae_pipeline.py
import torch
from .autoencoder_dc import AutoencoderDC
import torchaudio
import logging
try:
import torchaudio
except:
logging.warning("torchaudio missing, ACE model will be broken")
import torchvision.transforms as transforms
from .music_vocoder import ADaMoSHiFiGANV1

View File

@ -2,7 +2,12 @@
import torch
import torch.nn as nn
from torch import Tensor
from torchaudio.transforms import MelScale
import logging
try:
from torchaudio.transforms import MelScale
except:
logging.warning("torchaudio missing, ACE model will be broken")
import comfy.model_management
class LinearSpectrogram(nn.Module):