Skip to content

Commit dc6b6d1

Browse files
author
刘鑫
committed
Fx: capture compile error on Windows
1 parent cef6aef commit dc6b6d1

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies = [
3636
"addict",
3737
"wetext",
3838
"modelscope>=1.22.0",
39-
"datasets>=2,<4",
39+
"datasets>=3,<4",
4040
"huggingface-hub",
4141
"pydantic",
4242
"tqdm",

src/voxcpm/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import torch
22
import torchaudio
33
import os
4+
import re
45
import tempfile
56
from huggingface_hub import snapshot_download
67
from .model.voxcpm import VoxCPMModel
@@ -131,6 +132,7 @@ def generate(self,
131132
raise ValueError("prompt_wav_path and prompt_text must both be provided or both be None")
132133

133134
text = text.replace("\n", " ")
135+
text = re.sub(r'\s+', ' ', text)
134136
temp_prompt_wav_path = None
135137

136138
try:

src/voxcpm/model/voxcpm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def optimize(self):
160160
self.feat_encoder_step = torch.compile(self.feat_encoder, mode="reduce-overhead", fullgraph=True)
161161
self.feat_decoder.estimator = torch.compile(self.feat_decoder.estimator, mode="reduce-overhead", fullgraph=True)
162162
except Exception as e:
163-
print(e)
164-
print("VoxCPMModel can not be optimized by torch.compile, using original forward_step functions")
163+
print(f"Error: {e}")
164+
print("Warning: VoxCPMModel can not be optimized by torch.compile, using original forward_step functions")
165165
self.base_lm.forward_step = self.base_lm.forward_step
166166
self.residual_lm.forward_step = self.residual_lm.forward_step
167167
self.feat_encoder_step = self.feat_encoder

0 commit comments

Comments
 (0)