added fix for failed dependency imports
This commit is contained in:
@@ -18,6 +18,12 @@ Supports a MAXIMUM of 40 seconds. Iv tried removing this limitation, but the mod
|
||||
pip install -r ComfyUI_Fill-ChatterBox/requirements.txt
|
||||
```
|
||||
|
||||
3. (Optional) Install watermarking support:
|
||||
```bash
|
||||
pip install resemble-perth
|
||||
```
|
||||
**Note**: The `resemble-perth` package may have compatibility issues with Python 3.12+. If you encounter import errors, the nodes will still function without watermarking.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -37,6 +43,8 @@ Supports a MAXIMUM of 40 seconds. Iv tried removing this limitation, but the mod
|
||||
- Added seed parameter to both TTS and VC nodes for reproducible generation
|
||||
- Seed range: 0 to 4,294,967,295 (32-bit integer)
|
||||
- Enables consistent audio output for debugging and workflow control
|
||||
- Made Perth watermarking optional to fix Python 3.12+ compatibility issues
|
||||
- Nodes now function without watermarking if resemble-perth import fails
|
||||
|
||||
### 5/31/2025
|
||||
- Added Persistent model loading, and loading bar functionality
|
||||
|
||||
@@ -3,8 +3,15 @@ from pathlib import Path
|
||||
|
||||
import librosa
|
||||
import torch
|
||||
import perth
|
||||
import torch.nn.functional as F
|
||||
|
||||
# Optional Perth watermarking - gracefully handle import failure
|
||||
try:
|
||||
import perth
|
||||
PERTH_AVAILABLE = True
|
||||
except ImportError:
|
||||
PERTH_AVAILABLE = False
|
||||
print("Warning: Perth watermarking not available. Audio will be generated without watermarking.")
|
||||
from huggingface_hub import hf_hub_download
|
||||
from safetensors.torch import load_file
|
||||
|
||||
@@ -123,7 +130,7 @@ class ChatterboxTTS:
|
||||
self.tokenizer = tokenizer
|
||||
self.device = device
|
||||
self.conds = conds
|
||||
self.watermarker = perth.PerthImplicitWatermarker()
|
||||
self.watermarker = perth.PerthImplicitWatermarker() if PERTH_AVAILABLE else None
|
||||
|
||||
@classmethod
|
||||
def from_local(cls, ckpt_dir, device) -> 'ChatterboxTTS':
|
||||
@@ -259,5 +266,8 @@ class ChatterboxTTS:
|
||||
ref_dict=self.conds.gen,
|
||||
)
|
||||
wav = wav.squeeze(0).detach().cpu().numpy()
|
||||
watermarked_wav = self.watermarker.apply_watermark(wav, sample_rate=self.sr)
|
||||
return torch.from_numpy(watermarked_wav).unsqueeze(0)
|
||||
if self.watermarker is not None:
|
||||
watermarked_wav = self.watermarker.apply_watermark(wav, sample_rate=self.sr)
|
||||
return torch.from_numpy(watermarked_wav).unsqueeze(0)
|
||||
else:
|
||||
return torch.from_numpy(wav).unsqueeze(0)
|
||||
@@ -2,9 +2,16 @@ from pathlib import Path
|
||||
|
||||
import librosa
|
||||
import torch
|
||||
import perth
|
||||
from huggingface_hub import hf_hub_download
|
||||
|
||||
# Optional Perth watermarking - gracefully handle import failure
|
||||
try:
|
||||
import perth
|
||||
PERTH_AVAILABLE = True
|
||||
except ImportError:
|
||||
PERTH_AVAILABLE = False
|
||||
print("Warning: Perth watermarking not available. Audio will be generated without watermarking.")
|
||||
|
||||
from .models.s3tokenizer import S3_SR
|
||||
from .models.s3gen import S3GEN_SR, S3Gen
|
||||
|
||||
@@ -25,7 +32,7 @@ class ChatterboxVC:
|
||||
self.sr = S3GEN_SR
|
||||
self.s3gen = s3gen
|
||||
self.device = device
|
||||
self.watermarker = perth.PerthImplicitWatermarker()
|
||||
self.watermarker = perth.PerthImplicitWatermarker() if PERTH_AVAILABLE else None
|
||||
if ref_dict is None:
|
||||
self.ref_dict = None
|
||||
else:
|
||||
@@ -99,5 +106,8 @@ class ChatterboxVC:
|
||||
ref_dict=self.ref_dict,
|
||||
)
|
||||
wav = wav.squeeze(0).detach().cpu().numpy()
|
||||
watermarked_wav = self.watermarker.apply_watermark(wav, sample_rate=self.sr)
|
||||
return torch.from_numpy(watermarked_wav).unsqueeze(0)
|
||||
if self.watermarker is not None:
|
||||
watermarked_wav = self.watermarker.apply_watermark(wav, sample_rate=self.sr)
|
||||
return torch.from_numpy(watermarked_wav).unsqueeze(0)
|
||||
else:
|
||||
return torch.from_numpy(wav).unsqueeze(0)
|
||||
+3
-2
@@ -4,7 +4,8 @@ librosa
|
||||
s3tokenizer
|
||||
transformers
|
||||
diffusers
|
||||
resemble-perth
|
||||
omegaconf
|
||||
conformer
|
||||
safetensors
|
||||
safetensors
|
||||
# Optional watermarking (may have Python 3.12+ compatibility issues)
|
||||
# resemble-perth
|
||||
Reference in New Issue
Block a user