Skip to content

Commit b805f27

Browse files
add voxcpm snippet (#1755)
Waiting for this PR to be merged: https://huggingface.co/openbmb/VoxCPM-0.5B/discussions/4 Co-authored-by: vb <[email protected]>
1 parent 3f3417a commit b805f27

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

packages/tasks/src/model-libraries-snippets.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,29 @@ export const voicecraft = (model: ModelData): string[] => [
17341734
model = VoiceCraft.from_pretrained("${model.id}")`,
17351735
];
17361736

1737+
export const voxcpm = (model: ModelData): string[] => [
1738+
`import soundfile as sf
1739+
from voxcpm import VoxCPM
1740+
1741+
model = VoxCPM.from_pretrained("${model.id}")
1742+
1743+
wav = model.generate(
1744+
text="VoxCPM is an innovative end-to-end TTS model from ModelBest, designed to generate highly expressive speech.",
1745+
prompt_wav_path=None, # optional: path to a prompt speech for voice cloning
1746+
prompt_text=None, # optional: reference text
1747+
cfg_value=2.0, # LM guidance on LocDiT, higher for better adherence to the prompt, but maybe worse
1748+
inference_timesteps=10, # LocDiT inference timesteps, higher for better result, lower for fast speed
1749+
normalize=True, # enable external TN tool
1750+
denoise=True, # enable external Denoise tool
1751+
retry_badcase=True, # enable retrying mode for some bad cases (unstoppable)
1752+
retry_badcase_max_times=3, # maximum retrying times
1753+
retry_badcase_ratio_threshold=6.0, # maximum length restriction for bad case detection (simple but effective), it could be adjusted for slow pace speech
1754+
)
1755+
1756+
sf.write("output.wav", wav, 16000)
1757+
print("saved: output.wav")`,
1758+
];
1759+
17371760
export const vui = (): string[] => [
17381761
`# !pip install git+https://github.com/fluxions-ai/vui
17391762

packages/tasks/src/model-libraries.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
12161216
docsUrl: "https://github.com/jasonppy/VoiceCraft",
12171217
snippets: snippets.voicecraft,
12181218
},
1219+
voxcpm: {
1220+
prettyLabel: "VoxCPM",
1221+
repoName: "VoxCPM",
1222+
repoUrl: "https://github.com/OpenBMB/VoxCPM",
1223+
snippets: snippets.voxcpm,
1224+
filter: false,
1225+
},
12191226
vui: {
12201227
prettyLabel: "Vui",
12211228
repoName: "Vui",

0 commit comments

Comments
 (0)