File tree Expand file tree Collapse file tree 3 files changed +25
-9
lines changed Expand file tree Collapse file tree 3 files changed +25
-9
lines changed Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 3.13 FATAL_ERROR )
2
2
project (sherpa-onnx )
3
3
4
- set (SHERPA_ONNX_VERSION "1.8.8 " )
4
+ set (SHERPA_ONNX_VERSION "1.8.9 " )
5
5
6
6
# Disable warning about
7
7
#
Original file line number Diff line number Diff line change @@ -196,20 +196,27 @@ std::vector<int64_t> Lexicon::ConvertTextToTokenIdsChinese(
196
196
197
197
std::vector<int64_t > ans;
198
198
199
+ int32_t blank = -1 ;
200
+ if (token2id_.count (" " )) {
201
+ blank = token2id_.at (" " );
202
+ }
203
+
199
204
int32_t sil = -1 ;
200
205
int32_t eos = -1 ;
201
206
if (token2id_.count (" sil" )) {
202
207
sil = token2id_.at (" sil" );
203
208
eos = token2id_.at (" eos" );
204
- } else {
205
- sil = 0 ;
206
209
}
207
210
208
- ans.push_back (sil);
211
+ if (sil != -1 ) {
212
+ ans.push_back (sil);
213
+ }
209
214
210
215
for (const auto &w : words) {
211
216
if (punctuations_.count (w)) {
212
- ans.push_back (sil);
217
+ if (sil != -1 ) {
218
+ ans.push_back (sil);
219
+ }
213
220
continue ;
214
221
}
215
222
@@ -220,11 +227,19 @@ std::vector<int64_t> Lexicon::ConvertTextToTokenIdsChinese(
220
227
221
228
const auto &token_ids = word2ids_.at (w);
222
229
ans.insert (ans.end (), token_ids.begin (), token_ids.end ());
230
+ if (blank != -1 ) {
231
+ ans.push_back (blank);
232
+ }
233
+ }
234
+
235
+ if (sil != -1 ) {
236
+ ans.push_back (sil);
223
237
}
224
- ans. push_back (sil);
238
+
225
239
if (eos != -1 ) {
226
240
ans.push_back (eos);
227
241
}
242
+
228
243
return ans;
229
244
}
230
245
@@ -252,7 +267,7 @@ std::vector<int64_t> Lexicon::ConvertTextToTokenIdsEnglish(
252
267
int32_t blank = token2id_.at (" " );
253
268
254
269
std::vector<int64_t > ans;
255
- if (is_piper_) {
270
+ if (is_piper_ && token2id_. count ( " ^ " ) ) {
256
271
ans.push_back (token2id_.at (" ^" )); // sos
257
272
}
258
273
@@ -277,7 +292,7 @@ std::vector<int64_t> Lexicon::ConvertTextToTokenIdsEnglish(
277
292
ans.resize (ans.size () - 1 );
278
293
}
279
294
280
- if (is_piper_) {
295
+ if (is_piper_ && token2id_. count ( " $ " ) ) {
281
296
ans.push_back (token2id_.at (" $" )); // eos
282
297
}
283
298
Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ class OfflineTtsVitsModel::Impl {
81
81
82
82
std::string comment;
83
83
SHERPA_ONNX_READ_META_DATA_STR (comment, " comment" );
84
- if (comment.find (" piper" ) != std::string::npos) {
84
+ if (comment.find (" piper" ) != std::string::npos ||
85
+ comment.find (" coqui" ) != std::string::npos) {
85
86
is_piper_ = true ;
86
87
}
87
88
}
You can’t perform that action at this time.
0 commit comments