Thomcles commited on
Commit
43d5156
·
verified ·
1 Parent(s): 2a1fb64

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +37 -1
README.md CHANGED
@@ -17,7 +17,7 @@ tags:
17
  - Emilia
18
  ---
19
 
20
- ## Chatterbox TTS French 🥖
21
 
22
  **Chatterbox TTS French** is a fine-tuned text-to-speech model specialized for the French language. The model has been trained on high-quality voice data for natural and expressive speech synthesis.
23
 
@@ -30,4 +30,40 @@ tags:
30
  This model is suitable for anyone seeking a fluent and expressive TTS system in French.
31
  Feel free to test, adapt, or improve it for your specific use case.
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  Interested in fine-tuning a TTS model in a specific language or building a multilingual voice solution? Don’t hesitate to reach out.
 
17
  - Emilia
18
  ---
19
 
20
+ # Chatterbox TTS French 🥖
21
 
22
  **Chatterbox TTS French** is a fine-tuned text-to-speech model specialized for the French language. The model has been trained on high-quality voice data for natural and expressive speech synthesis.
23
 
 
30
  This model is suitable for anyone seeking a fluent and expressive TTS system in French.
31
  Feel free to test, adapt, or improve it for your specific use case.
32
 
33
+ ## Usage Example
34
+
35
+ Here’s how to generate speech using Chatterbox-TTS French:
36
+
37
+ ```python
38
+ import torch
39
+ import soundfile as sf
40
+ from chatterbox.tts import ChatterboxTTS
41
+ from huggingface_hub import hf_hub_download
42
+ from safetensors.torch import load_file
43
+ MODEL_REPO = "Thomcles/Chatterbox-TTS-French"
44
+ T3_CHECKPOINT_FILE = "t3_cfg.safetensors"
45
+ device = "cuda" if torch.cuda.is_available() else "cpu"
46
+ model = ChatterboxTTS.from_pretrained(device=device)
47
+ print("Downloading and applying German patch...")
48
+ checkpoint_path = hf_hub_download(repo_id=MODEL_REPO, filename=T3_CHECKPOINT_FILE)
49
+ t3_state = load_file(checkpoint_path, device="cpu")
50
+ model.t3.load_state_dict(t3_state)
51
+ print("Patch applied successfully.")
52
+ text = "Tief im verwunschenen Wald, wo die Bäume uralte Geheimnisse flüsterten, lebte ein kleiner Gnom namens Fips, der die Sprache der Tiere verstand."
53
+ reference_audio_path = "/content/uitoll.mp3"
54
+ output_path = "output_cloned_voice.wav"
55
+ print("Generating speech...")
56
+ with torch.inference_mode():
57
+ wav = model.generate(
58
+ text,
59
+ audio_prompt_path=reference_audio_path,
60
+ exaggeration=0.5,
61
+ temperature=0.6,
62
+ cfg_weight=0.3,
63
+ )
64
+ sf.write(output_path, wav.squeeze().cpu().numpy(), model.sr)
65
+ print(f"Audio saved to {output_path}")
66
+ ```
67
+
68
+
69
  Interested in fine-tuning a TTS model in a specific language or building a multilingual voice solution? Don’t hesitate to reach out.