voidful commited on
Commit
71084e9
·
verified ·
1 Parent(s): 78b3cbe

Document selected stable release and conditioning contract

Browse files
Files changed (3) hide show
  1. README.md +49 -44
  2. USAGE.md +31 -15
  3. release_metadata.json +26 -0
README.md CHANGED
@@ -13,12 +13,15 @@ license: other
13
 
14
  # BlueMagpie-TTS
15
 
16
- BlueMagpie-TTS checkpoint for research and evaluation.
 
 
 
17
 
18
  This repository contains the inference artifact only: model weights, AudioVAE
19
  weights, tokenizer files, config, and usage documentation. It does not include
20
- optimizer state, scheduler state, training logs, speaker tables, local configs,
21
- or training-data metadata.
22
 
23
  ## Intended Use
24
 
@@ -33,8 +36,8 @@ or training-data metadata.
33
  ```bash
34
  git clone https://github.com/voidful/BlueMagpie-TTS
35
  cd BlueMagpie-TTS
36
- pip install -e ".[train]"
37
- pip install soundfile huggingface_hub
38
  ```
39
 
40
  ## Quick Start
@@ -43,17 +46,22 @@ pip install soundfile huggingface_hub
43
  from huggingface_hub import snapshot_download
44
  import soundfile as sf
45
 
46
- from bluemagpie import BlueMagpieModel
47
 
48
- model_dir = snapshot_download("OpenFormosa/BlueMagpie-TTS", token=True)
49
  model = BlueMagpieModel.from_local(model_dir, training=False, device="cuda")
50
 
 
 
 
51
  audio = model.generate(
52
  target_text="這是 AI TTS code switching 測試。",
53
- reference_wav_path="reference_speaker.wav",
54
  cfg_value=2.0,
55
  inference_timesteps=10,
56
  retry_badcase=True,
 
 
57
  )
58
 
59
  sf.write("sample.wav", audio.detach().cpu().numpy(), model.sample_rate)
@@ -68,56 +76,41 @@ audio = model.generate(
68
  speaker_centroid=centroid_tensor,
69
  cfg_value=2.0,
70
  inference_timesteps=10,
 
 
71
  )
72
 
73
- # speaker-reference-audio-only: no reference transcript required
 
 
 
74
  audio = model.generate(
75
  target_text="今天的會議改到下午三點。",
76
- reference_wav_path="reference_speaker.wav",
77
  cfg_value=2.0,
78
  inference_timesteps=10,
 
 
79
  )
80
 
81
  ```
82
 
83
  Only use reference audio or speaker centroids from speakers you have permission
84
  to synthesize. Reference clips should be at least 3 seconds. The
85
- speaker-reference-audio-only mode uses the raw reference-audio token path and
86
- does not require a reference transcript.
87
-
88
- ## Centroid Demo
89
-
90
- This repository keeps two small centroid demo artifacts under `checkpoints/` so
91
- users can test the `centroid-only` path without building a centroid table first:
92
-
93
- - `checkpoints/hung_yi_lee_speaker_centroids.pt`
94
- - `checkpoints/speaker_centroids.pt`
95
 
96
- These files are demo speaker-conditioning artifacts only. They are not training
97
- data, optimizer state, scheduler state, logs, generated samples, or a complete
98
- speaker registry.
99
-
100
- ```python
101
- import torch
102
 
103
- table = torch.load("checkpoints/speaker_centroids.pt", map_location="cpu")
104
- speaker_ids = table["speaker_ids"]
105
- centroids = table["centroids"]
106
 
107
- audio = model.generate(
108
- target_text="這是 centroid-only 的測試。",
109
- speaker_centroid=centroids[0],
110
- cfg_value=2.0,
111
- inference_timesteps=10,
112
- )
113
  ```
114
 
115
- ## Long Text
116
-
117
- For long-form synthesis, split text into sentence-sized chunks and concatenate
118
- the generated waveforms. For stronger continuity, keep the same centroid or
119
- reference audio across chunks.
120
-
121
  ## Evaluation
122
 
123
  Numbers below are from an internal held-out evaluation set. The eval set and
@@ -126,7 +119,8 @@ training data are intentionally not described in this model card.
126
  | System | Setting | CER | WER |
127
  | --- | --- | ---: | ---: |
128
  | BlueMagpie-TTS | centroid-only | 7.44% | 8.57% |
129
- | BlueMagpie-TTS | speaker-reference-audio-only | 8.99% | 11.77% |
 
130
  | Reference baseline | same internal eval | 11.45% | 14.83% |
131
 
132
  Long-form diagnostics on the selected checkpoint:
@@ -134,16 +128,26 @@ Long-form diagnostics on the selected checkpoint:
134
  | Metric | Value |
135
  | --- | ---: |
136
  | centroid-only CER / WER | 7.51% / 7.51% |
137
- | speaker-reference-audio-only CER / WER | 8.92% / 8.92% |
138
  | Median chars/sec | 4.017 |
139
  | speaker-reference chunk speaker-sim drop | 0.109 |
140
 
 
 
 
 
 
141
  ## Limitations
142
 
143
  - Metrics are not a public benchmark and should be used only for internal model
144
  selection.
145
  - Speaker similarity depends on the quality and rights-cleared status of the
146
  supplied reference audio or centroid.
 
 
 
 
 
147
  - Very long passages should be chunked to avoid stop-token and prosody drift.
148
  - Generated speech may be incorrect; do not use it as a real-world notification
149
  without human review.
@@ -154,5 +158,6 @@ Long-form diagnostics on the selected checkpoint:
154
  - `audiovae.pth`: AudioVAE weights.
155
  - `config.json`: BlueMagpie architecture/runtime config.
156
  - `tokenizer.json`, `tokenizer_config.json`: tokenizer files.
157
- - `checkpoints/*speaker_centroids.pt`: small centroid demo artifacts.
 
158
  - `USAGE.md`: expanded usage guide.
 
13
 
14
  # BlueMagpie-TTS
15
 
16
+ BlueMagpie-TTS checkpoint for research and evaluation. The files in this Hub
17
+ repository are the selected balanced two-mode release. Newer experimental
18
+ checkpoints are not promoted unless they pass the same intelligibility,
19
+ duration, endpoint, and speaker-stability gates.
20
 
21
  This repository contains the inference artifact only: model weights, AudioVAE
22
  weights, tokenizer files, config, and usage documentation. It does not include
23
+ optimizer state, scheduler state, training logs, private speaker registries,
24
+ local configs, or training-data metadata.
25
 
26
  ## Intended Use
27
 
 
36
  ```bash
37
  git clone https://github.com/voidful/BlueMagpie-TTS
38
  cd BlueMagpie-TTS
39
+ pip install -e ".[speaker]"
40
+ pip install soundfile
41
  ```
42
 
43
  ## Quick Start
 
46
  from huggingface_hub import snapshot_download
47
  import soundfile as sf
48
 
49
+ from bluemagpie import BlueMagpieModel, speaker_embedding_from_wav
50
 
51
+ model_dir = snapshot_download("OpenFormosa/BlueMagpie-TTS")
52
  model = BlueMagpieModel.from_local(model_dir, training=False, device="cuda")
53
 
54
+ reference_embedding = speaker_embedding_from_wav(
55
+ "reference_speaker.wav", window_sec=3.0, hop_sec=1.5
56
+ )
57
  audio = model.generate(
58
  target_text="這是 AI TTS code switching 測試。",
59
+ speaker_centroid=reference_embedding,
60
  cfg_value=2.0,
61
  inference_timesteps=10,
62
  retry_badcase=True,
63
+ stop_threshold=0.65,
64
+ stop_consecutive=2,
65
  )
66
 
67
  sf.write("sample.wav", audio.detach().cpu().numpy(), model.sample_rate)
 
76
  speaker_centroid=centroid_tensor,
77
  cfg_value=2.0,
78
  inference_timesteps=10,
79
+ stop_threshold=0.65,
80
+ stop_consecutive=2,
81
  )
82
 
83
+ # speaker-reference-audio-only: extract once; no transcript required
84
+ reference_embedding = speaker_embedding_from_wav(
85
+ "reference_speaker.wav", window_sec=3.0, hop_sec=1.5
86
+ )
87
  audio = model.generate(
88
  target_text="今天的會議改到下午三點。",
89
+ speaker_centroid=reference_embedding,
90
  cfg_value=2.0,
91
  inference_timesteps=10,
92
+ stop_threshold=0.65,
93
+ stop_consecutive=2,
94
  )
95
 
96
  ```
97
 
98
  Only use reference audio or speaker centroids from speakers you have permission
99
  to synthesize. Reference clips should be at least 3 seconds. The
100
+ speaker-reference-audio-only mode uses one window-averaged speaker embedding
101
+ for the full request and does not require a reference transcript. Raw reference
102
+ tokens remain a separately evaluated research path.
 
 
 
 
 
 
 
103
 
104
+ ## Long Text
 
 
 
 
 
105
 
106
+ Use the CLI for long-form synthesis. It preserves punctuation, reuses one
107
+ speaker embedding for every chunk, applies punctuation-aware pauses, and can
108
+ set a minimum duration from the target speaking rate:
109
 
110
+ ```bash
111
+ python scripts/generate_tts.py --checkpoint /path/to/model-snapshot --mode speaker-reference-audio-only --speaker-reference-wav /path/to/rights-cleared-reference.wav --reference-audio-conditioning speaker-embedding --text-file long_text.txt --chunk-chars 45 --min-chunk-chars 12 --target-chars-per-sec 4.2 --stop-threshold 0.65 --stop-consecutive 2 --crossfade-ms 80 --out long.wav
 
 
 
 
112
  ```
113
 
 
 
 
 
 
 
114
  ## Evaluation
115
 
116
  Numbers below are from an internal held-out evaluation set. The eval set and
 
119
  | System | Setting | CER | WER |
120
  | --- | --- | ---: | ---: |
121
  | BlueMagpie-TTS | centroid-only | 7.44% | 8.57% |
122
+ | BlueMagpie-TTS | raw-reference-tokens research path | 8.99% | 11.77% |
123
+ | BlueMagpie-TTS | speaker-reference-embedding production path | pending re-qualification | pending re-qualification |
124
  | Reference baseline | same internal eval | 11.45% | 14.83% |
125
 
126
  Long-form diagnostics on the selected checkpoint:
 
128
  | Metric | Value |
129
  | --- | ---: |
130
  | centroid-only CER / WER | 7.51% / 7.51% |
131
+ | raw-reference-tokens CER / WER | 8.92% / 8.92% |
132
  | Median chars/sec | 4.017 |
133
  | speaker-reference chunk speaker-sim drop | 0.109 |
134
 
135
+ The measured reference-audio rows above used the raw-reference-token research
136
+ backend. They are not presented as production speaker-embedding results. The
137
+ long-form rate was measured with controlled chunked inference; it does not show
138
+ that unrestricted single-pass endpoint behavior is fully solved.
139
+
140
  ## Limitations
141
 
142
  - Metrics are not a public benchmark and should be used only for internal model
143
  selection.
144
  - Speaker similarity depends on the quality and rights-cleared status of the
145
  supplied reference audio or centroid.
146
+ - The windowed speaker-embedding backend is the recommended production path,
147
+ but its full release-gate metrics are still pending re-qualification.
148
+ - Free-running endpoint behavior can still produce rare early stops, overruns,
149
+ repetitions, or extra speech. Keep retry and stop hysteresis enabled for
150
+ offline generation and inspect important outputs.
151
  - Very long passages should be chunked to avoid stop-token and prosody drift.
152
  - Generated speech may be incorrect; do not use it as a real-world notification
153
  without human review.
 
158
  - `audiovae.pth`: AudioVAE weights.
159
  - `config.json`: BlueMagpie architecture/runtime config.
160
  - `tokenizer.json`, `tokenizer_config.json`: tokenizer files.
161
+ - `checkpoints/*speaker_centroids.pt`: small centroid demo artifacts retained
162
+ on the Hub for centroid-only examples.
163
  - `USAGE.md`: expanded usage guide.
USAGE.md CHANGED
@@ -5,17 +5,17 @@ This is an inference checkpoint. Install the local package first:
5
  ```bash
6
  git clone https://github.com/voidful/BlueMagpie-TTS
7
  cd BlueMagpie-TTS
8
- pip install -e ".[train]"
9
- pip install soundfile huggingface_hub
10
  ```
11
 
12
  Download and load:
13
 
14
  ```python
15
  from huggingface_hub import snapshot_download
16
- from bluemagpie import BlueMagpieModel
17
 
18
- model_dir = snapshot_download("OpenFormosa/BlueMagpie-TTS", token=True)
19
  model = BlueMagpieModel.from_local(model_dir, training=False, device="cuda")
20
  ```
21
 
@@ -24,12 +24,17 @@ Generate a short utterance:
24
  ```python
25
  import soundfile as sf
26
 
 
 
 
27
  wav = model.generate(
28
  target_text="這是合成語音測試。",
29
- reference_wav_path="reference_speaker.wav",
30
  cfg_value=2.0,
31
  inference_timesteps=10,
32
  retry_badcase=True,
 
 
33
  )
34
  sf.write("short.wav", wav.detach().cpu().numpy(), model.sample_rate)
35
  ```
@@ -43,14 +48,21 @@ wav = model.generate(
43
  speaker_centroid=centroid_tensor,
44
  cfg_value=2.0,
45
  inference_timesteps=10,
 
 
46
  )
47
 
48
- # speaker-reference-audio-only; no reference transcript required
 
 
 
49
  wav = model.generate(
50
  target_text="明天 meeting 取消一次,我們大家放假。",
51
- reference_wav_path="reference_speaker.wav",
52
  cfg_value=2.0,
53
  inference_timesteps=10,
 
 
54
  )
55
 
56
  ```
@@ -60,7 +72,7 @@ Centroid demo:
60
  ```python
61
  import torch
62
 
63
- table = torch.load(f"{model_dir}/checkpoints/speaker_centroids.pt", map_location="cpu")
64
  wav = model.generate(
65
  target_text="這是 centroid demo 的測試。",
66
  speaker_centroid=table["centroids"][0],
@@ -78,7 +90,7 @@ import soundfile as sf
78
  chunks = []
79
  for chunk in model.generate_streaming(
80
  target_text="這是一段串流語音合成測試。",
81
- reference_wav_path="reference_speaker.wav",
82
  cfg_value=2.0,
83
  inference_timesteps=10,
84
  ):
@@ -90,19 +102,23 @@ sf.write("streaming.wav", wav.numpy(), model.sample_rate)
90
 
91
  Long text:
92
 
93
- 1. Split the text by sentence or paragraph.
94
- 2. Generate each chunk separately.
95
- 3. Concatenate the waveforms with a short crossfade if needed.
96
- 4. Keep the same centroid or reference audio across chunks to reduce speaker
97
- drift.
 
 
98
 
99
  Recommended generation defaults:
100
 
101
  - `cfg_value=2.0`
102
  - `inference_timesteps=10`
103
  - `retry_badcase=True` for offline generation
 
104
  - `max_len=2000` unless a longer chunk is intentionally needed
105
- - Reference wavs for `reference_wav_path=...` should be at least 3 seconds.
 
106
 
107
  Safety:
108
 
 
5
  ```bash
6
  git clone https://github.com/voidful/BlueMagpie-TTS
7
  cd BlueMagpie-TTS
8
+ pip install -e ".[speaker]"
9
+ pip install soundfile
10
  ```
11
 
12
  Download and load:
13
 
14
  ```python
15
  from huggingface_hub import snapshot_download
16
+ from bluemagpie import BlueMagpieModel, speaker_embedding_from_wav
17
 
18
+ model_dir = snapshot_download("OpenFormosa/BlueMagpie-TTS")
19
  model = BlueMagpieModel.from_local(model_dir, training=False, device="cuda")
20
  ```
21
 
 
24
  ```python
25
  import soundfile as sf
26
 
27
+ reference_embedding = speaker_embedding_from_wav(
28
+ "reference_speaker.wav", window_sec=3.0, hop_sec=1.5
29
+ )
30
  wav = model.generate(
31
  target_text="這是合成語音測試。",
32
+ speaker_centroid=reference_embedding,
33
  cfg_value=2.0,
34
  inference_timesteps=10,
35
  retry_badcase=True,
36
+ stop_threshold=0.65,
37
+ stop_consecutive=2,
38
  )
39
  sf.write("short.wav", wav.detach().cpu().numpy(), model.sample_rate)
40
  ```
 
48
  speaker_centroid=centroid_tensor,
49
  cfg_value=2.0,
50
  inference_timesteps=10,
51
+ stop_threshold=0.65,
52
+ stop_consecutive=2,
53
  )
54
 
55
+ # speaker-reference-audio-only; extract once, no reference transcript required
56
+ reference_embedding = speaker_embedding_from_wav(
57
+ "reference_speaker.wav", window_sec=3.0, hop_sec=1.5
58
+ )
59
  wav = model.generate(
60
  target_text="明天 meeting 取消一次,我們大家放假。",
61
+ speaker_centroid=reference_embedding,
62
  cfg_value=2.0,
63
  inference_timesteps=10,
64
+ stop_threshold=0.65,
65
+ stop_consecutive=2,
66
  )
67
 
68
  ```
 
72
  ```python
73
  import torch
74
 
75
+ table = torch.load(model_dir + "/checkpoints/speaker_centroids.pt", map_location="cpu")
76
  wav = model.generate(
77
  target_text="這是 centroid demo 的測試。",
78
  speaker_centroid=table["centroids"][0],
 
90
  chunks = []
91
  for chunk in model.generate_streaming(
92
  target_text="這是一段串流語音合成測試。",
93
+ speaker_centroid=reference_embedding,
94
  cfg_value=2.0,
95
  inference_timesteps=10,
96
  ):
 
102
 
103
  Long text:
104
 
105
+ ```bash
106
+ python scripts/generate_tts.py --checkpoint /path/to/model-snapshot --mode speaker-reference-audio-only --speaker-reference-wav /path/to/rights-cleared-reference.wav --reference-audio-conditioning speaker-embedding --text-file long_text.txt --chunk-chars 45 --min-chunk-chars 12 --target-chars-per-sec 4.2 --stop-threshold 0.65 --stop-consecutive 2 --crossfade-ms 80 --out long.wav
107
+ ```
108
+
109
+ This path extracts the windowed speaker embedding once and reuses it for every
110
+ chunk. `--reference-audio-conditioning tokens` enables the raw-reference-token
111
+ research backend; it is not the production default.
112
 
113
  Recommended generation defaults:
114
 
115
  - `cfg_value=2.0`
116
  - `inference_timesteps=10`
117
  - `retry_badcase=True` for offline generation
118
+ - `stop_threshold=0.65`, `stop_consecutive=2` for offline generation
119
  - `max_len=2000` unless a longer chunk is intentionally needed
120
+ - `target-chars-per-sec=4.2` for controlled long-form chunking
121
+ - Reference wavs used to extract speaker embeddings should be at least 3 seconds.
122
 
123
  Safety:
124
 
release_metadata.json CHANGED
@@ -1,6 +1,7 @@
1
  {
2
  "format": "bluemagpie-pretrained",
3
  "checkpoint": "step_0006000",
 
4
  "files": [
5
  "pytorch_model.bin",
6
  "audiovae.pth",
@@ -8,6 +9,23 @@
8
  "tokenizer.json",
9
  "tokenizer_config.json"
10
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  "evaluation": {
12
  "scope": "internal held-out evaluation",
13
  "centroid_only": {
@@ -15,15 +33,23 @@
15
  "wer": 0.08565566378066376
16
  },
17
  "speaker_reference_audio_only": {
 
 
18
  "cer": 0.08992608978902839,
19
  "wer": 0.11774568024568023
20
  },
 
 
 
 
21
  "long_centroid_only": {
22
  "cer": 0.07511737089201878,
23
  "wer": 0.07511737089201878,
24
  "chars_per_second": 4.017351942663145
25
  },
26
  "long_speaker_reference_audio_only": {
 
 
27
  "cer": 0.0892018779342723,
28
  "wer": 0.0892018779342723,
29
  "chars_per_second": 4.017351942663145,
 
1
  {
2
  "format": "bluemagpie-pretrained",
3
  "checkpoint": "step_0006000",
4
+ "release_status": "selected_stable",
5
  "files": [
6
  "pytorch_model.bin",
7
  "audiovae.pth",
 
9
  "tokenizer.json",
10
  "tokenizer_config.json"
11
  ],
12
+ "artifacts": {
13
+ "pytorch_model.bin": {
14
+ "sha256": "e454c077ded2ce9d5f3b8ec4f336af840a2fe9912149d1f25afd4938bf7a0319"
15
+ },
16
+ "audiovae.pth": {
17
+ "sha256": "cc01a2d5d817910f185d959f8bb23d1a5ab80c9a03b7398ac86d7457cb663332"
18
+ }
19
+ },
20
+ "conditioning": {
21
+ "production": [
22
+ "centroid-only",
23
+ "speaker-reference-embedding"
24
+ ],
25
+ "experimental": [
26
+ "raw-reference-tokens"
27
+ ]
28
+ },
29
  "evaluation": {
30
  "scope": "internal held-out evaluation",
31
  "centroid_only": {
 
33
  "wer": 0.08565566378066376
34
  },
35
  "speaker_reference_audio_only": {
36
+ "backend": "raw_reference_tokens",
37
+ "release_role": "research",
38
  "cer": 0.08992608978902839,
39
  "wer": 0.11774568024568023
40
  },
41
+ "speaker_reference_embedding": {
42
+ "release_role": "production",
43
+ "status": "pending_requalification"
44
+ },
45
  "long_centroid_only": {
46
  "cer": 0.07511737089201878,
47
  "wer": 0.07511737089201878,
48
  "chars_per_second": 4.017351942663145
49
  },
50
  "long_speaker_reference_audio_only": {
51
+ "backend": "raw_reference_tokens",
52
+ "release_role": "research",
53
  "cer": 0.0892018779342723,
54
  "wer": 0.0892018779342723,
55
  "chars_per_second": 4.017351942663145,