update entrypoint

update fixtures to include all voices in remote JSON
add script to pre-validate and build voices
This commit is contained in:
timothycarambat
2024-08-06 11:44:56 -07:00
parent 3cc3d4b9a1
commit cfd191ea2c
5 changed files with 56 additions and 7 deletions
+6 -4
View File
@@ -8,12 +8,12 @@
"dist",
"package.json"
],
"module": "./dist/vits-web.js",
"module": "./dist/piper-tts-web.js",
"types": "./dist/index.d.ts",
"author": "team@mintplexlabs.com",
"exports": {
".": {
"import": "./dist/vits-web.js",
"import": "./dist/piper-tts-web.js",
"types": "./dist/index.d.ts"
}
},
@@ -44,10 +44,12 @@
"dev": "vite",
"build": "rm -r -f ./dist && tsc && vite build",
"preview": "vite preview",
"test": "npx playwright test --project=chromium"
"test": "npx playwright test --project=chromium",
"verify": "yarn build && cd scripts && node refresh-and-validate.mjs && cd .."
},
"devDependencies": {
"@playwright/test": "^1.35.1",
"object-deep-compare": "^1.2.0",
"typescript": "^5.2.2",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1"
@@ -55,4 +57,4 @@
"peerDependencies": {
"onnxruntime-web": "^1.18.0"
}
}
}
+34
View File
@@ -0,0 +1,34 @@
import { HF_BASE, PATH_MAP } from '../dist/piper-tts-web.js'
import STATIC from '../src/voices_static.json' assert { type: "json" };
import deepCompare from 'object-deep-compare'
(async () => {
try {
const remoteJSON = await fetch(`${HF_BASE}/voices.json`)
.then((res) => res.json());
const comparison = deepCompare.CompareProperties(STATIC, remoteJSON);
if (comparison.differences.length !== 0) {
console.log(`Differences detected between our stored and the remote JSON. Exiting early. Refresh static from ${HF_BASE}/voices.json.`);
console.log(comparison);
return;
}
console.log(`PATH_MAP has ${Object.keys(PATH_MAP).length} keys. We currently have ${Object.keys(remoteJSON).length} keys.`)
if (Object.keys(PATH_MAP).length === Object.keys(remoteJSON).length) return console.log("No keys are missing. We are up to date!")
const toAdd = {};
console.log("We are missing keys in PATH_MAP. Iterating...");
for (const key of Object.keys(remoteJSON)) {
if (PATH_MAP.hasOwnProperty(key)) continue;
console.log(`PATH_MAP missing ${key}`);
const lang = key.split('_', 1)[0];
toAdd[key] = `${lang}/${key.replaceAll('-', '/')}/${key}.onnx`;
}
console.log('Add the following records to the end of PATH_MAP object in ./fixtures.ts');
console.log(toAdd);
} catch (e) {
console.error(e)
} finally { return; }
})();
+7 -1
View File
@@ -137,5 +137,11 @@ export const PATH_MAP: Record<VoiceId, string> = {
'vi_VN-vais1000-medium': 'vi/vi_VN/vais1000/medium/vi_VN-vais1000-medium.onnx',
'vi_VN-vivos-x_low': 'vi/vi_VN/vivos/x_low/vi_VN-vivos-x_low.onnx',
'zh_CN-huayan-medium': 'zh/zh_CN/huayan/medium/zh_CN-huayan-medium.onnx',
'zh_CN-huayan-x_low': 'zh/zh_CN/huayan/x_low/zh_CN-huayan-x_low.onnx'
'zh_CN-huayan-x_low': 'zh/zh_CN/huayan/x_low/zh_CN-huayan-x_low.onnx',
// Added by Mintplex Labs - missing or new.
'cy_GB-gwryw_gogleddol-medium': 'cy/cy_GB/gwryw_gogleddol/medium/cy_GB-gwryw_gogleddol-medium.onnx',
'en_US-bryce-medium': 'en/en_US/bryce/medium/en_US-bryce-medium.onnx',
'en_US-john-medium': 'en/en_US/john/medium/en_US-john-medium.onnx',
'en_US-norman-medium': 'en/en_US/norman/medium/en_US-norman-medium.onnx',
'it_IT-paola-medium': 'it/it_IT/paola/medium/it_IT-paola-medium.onnx'
}
+1 -1
View File
@@ -1,4 +1,4 @@
export type VoiceId = 'ar_JO-kareem-low' | 'ar_JO-kareem-medium' | 'ca_ES-upc_ona-medium' | 'ca_ES-upc_ona-x_low' | 'ca_ES-upc_pau-x_low' | 'cs_CZ-jirka-low' | 'cs_CZ-jirka-medium' | 'da_DK-talesyntese-medium' | 'de_DE-eva_k-x_low' | 'de_DE-karlsson-low' | 'de_DE-kerstin-low' | 'de_DE-mls-medium' | 'de_DE-pavoque-low' | 'de_DE-ramona-low' | 'de_DE-thorsten-high' | 'de_DE-thorsten-low' | 'de_DE-thorsten-medium' | 'de_DE-thorsten_emotional-medium' | 'el_GR-rapunzelina-low' | 'en_GB-alan-low' | 'en_GB-alan-medium' | 'en_GB-alba-medium' | 'en_GB-aru-medium' | 'en_GB-cori-high' | 'en_GB-cori-medium' | 'en_GB-jenny_dioco-medium' | 'en_GB-northern_english_male-medium' | 'en_GB-semaine-medium' | 'en_GB-southern_english_female-low' | 'en_GB-vctk-medium' | 'en_US-amy-low' | 'en_US-amy-medium' | 'en_US-arctic-medium' | 'en_US-danny-low' | 'en_US-hfc_female-medium' | 'en_US-hfc_male-medium' | 'en_US-joe-medium' | 'en_US-kathleen-low' | 'en_US-kristin-medium' | 'en_US-kusal-medium' | 'en_US-l2arctic-medium' | 'en_US-lessac-high' | 'en_US-lessac-low' | 'en_US-lessac-medium' | 'en_US-libritts-high' | 'en_US-libritts_r-medium' | 'en_US-ljspeech-high' | 'en_US-ljspeech-medium' | 'en_US-ryan-high' | 'en_US-ryan-low' | 'en_US-ryan-medium' | 'es_ES-carlfm-x_low' | 'es_ES-davefx-medium' | 'es_ES-mls_10246-low' | 'es_ES-mls_9972-low' | 'es_ES-sharvard-medium' | 'es_MX-ald-medium' | 'es_MX-claude-high' | 'fa_IR-amir-medium' | 'fa_IR-gyro-medium' | 'fi_FI-harri-low' | 'fi_FI-harri-medium' | 'fr_FR-gilles-low' | 'fr_FR-mls-medium' | 'fr_FR-mls_1840-low' | 'fr_FR-siwis-low' | 'fr_FR-siwis-medium' | 'fr_FR-tom-medium' | 'fr_FR-upmc-medium' | 'hu_HU-anna-medium' | 'hu_HU-berta-medium' | 'hu_HU-imre-medium' | 'is_IS-bui-medium' | 'is_IS-salka-medium' | 'is_IS-steinn-medium' | 'is_IS-ugla-medium' | 'it_IT-riccardo-x_low' | 'ka_GE-natia-medium' | 'kk_KZ-iseke-x_low' | 'kk_KZ-issai-high' | 'kk_KZ-raya-x_low' | 'lb_LU-marylux-medium' | 'ne_NP-google-medium' | 'ne_NP-google-x_low' | 'nl_BE-nathalie-medium' | 'nl_BE-nathalie-x_low' | 'nl_BE-rdh-medium' | 'nl_BE-rdh-x_low' | 'nl_NL-mls-medium' | 'nl_NL-mls_5809-low' | 'nl_NL-mls_7432-low' | 'no_NO-talesyntese-medium' | 'pl_PL-darkman-medium' | 'pl_PL-gosia-medium' | 'pl_PL-mc_speech-medium' | 'pl_PL-mls_6892-low' | 'pt_BR-edresson-low' | 'pt_BR-faber-medium' | 'pt_PT-tugão-medium' | 'ro_RO-mihai-medium' | 'ru_RU-denis-medium' | 'ru_RU-dmitri-medium' | 'ru_RU-irina-medium' | 'ru_RU-ruslan-medium' | 'sk_SK-lili-medium' | 'sl_SI-artur-medium' | 'sr_RS-serbski_institut-medium' | 'sv_SE-nst-medium' | 'sw_CD-lanfrica-medium' | 'tr_TR-dfki-medium' | 'tr_TR-fahrettin-medium' | 'tr_TR-fettah-medium' | 'uk_UA-lada-x_low' | 'uk_UA-ukrainian_tts-medium' | 'vi_VN-25hours_single-low' | 'vi_VN-vais1000-medium' | 'vi_VN-vivos-x_low' | 'zh_CN-huayan-medium' | 'zh_CN-huayan-x_low';
export type VoiceId = string | 'ar_JO-kareem-low' | 'ar_JO-kareem-medium' | 'ca_ES-upc_ona-medium' | 'ca_ES-upc_ona-x_low' | 'ca_ES-upc_pau-x_low' | 'cs_CZ-jirka-low' | 'cs_CZ-jirka-medium' | 'da_DK-talesyntese-medium' | 'de_DE-eva_k-x_low' | 'de_DE-karlsson-low' | 'de_DE-kerstin-low' | 'de_DE-mls-medium' | 'de_DE-pavoque-low' | 'de_DE-ramona-low' | 'de_DE-thorsten-high' | 'de_DE-thorsten-low' | 'de_DE-thorsten-medium' | 'de_DE-thorsten_emotional-medium' | 'el_GR-rapunzelina-low' | 'en_GB-alan-low' | 'en_GB-alan-medium' | 'en_GB-alba-medium' | 'en_GB-aru-medium' | 'en_GB-cori-high' | 'en_GB-cori-medium' | 'en_GB-jenny_dioco-medium' | 'en_GB-northern_english_male-medium' | 'en_GB-semaine-medium' | 'en_GB-southern_english_female-low' | 'en_GB-vctk-medium' | 'en_US-amy-low' | 'en_US-amy-medium' | 'en_US-arctic-medium' | 'en_US-danny-low' | 'en_US-hfc_female-medium' | 'en_US-hfc_male-medium' | 'en_US-joe-medium' | 'en_US-kathleen-low' | 'en_US-kristin-medium' | 'en_US-kusal-medium' | 'en_US-l2arctic-medium' | 'en_US-lessac-high' | 'en_US-lessac-low' | 'en_US-lessac-medium' | 'en_US-libritts-high' | 'en_US-libritts_r-medium' | 'en_US-ljspeech-high' | 'en_US-ljspeech-medium' | 'en_US-ryan-high' | 'en_US-ryan-low' | 'en_US-ryan-medium' | 'es_ES-carlfm-x_low' | 'es_ES-davefx-medium' | 'es_ES-mls_10246-low' | 'es_ES-mls_9972-low' | 'es_ES-sharvard-medium' | 'es_MX-ald-medium' | 'es_MX-claude-high' | 'fa_IR-amir-medium' | 'fa_IR-gyro-medium' | 'fi_FI-harri-low' | 'fi_FI-harri-medium' | 'fr_FR-gilles-low' | 'fr_FR-mls-medium' | 'fr_FR-mls_1840-low' | 'fr_FR-siwis-low' | 'fr_FR-siwis-medium' | 'fr_FR-tom-medium' | 'fr_FR-upmc-medium' | 'hu_HU-anna-medium' | 'hu_HU-berta-medium' | 'hu_HU-imre-medium' | 'is_IS-bui-medium' | 'is_IS-salka-medium' | 'is_IS-steinn-medium' | 'is_IS-ugla-medium' | 'it_IT-riccardo-x_low' | 'ka_GE-natia-medium' | 'kk_KZ-iseke-x_low' | 'kk_KZ-issai-high' | 'kk_KZ-raya-x_low' | 'lb_LU-marylux-medium' | 'ne_NP-google-medium' | 'ne_NP-google-x_low' | 'nl_BE-nathalie-medium' | 'nl_BE-nathalie-x_low' | 'nl_BE-rdh-medium' | 'nl_BE-rdh-x_low' | 'nl_NL-mls-medium' | 'nl_NL-mls_5809-low' | 'nl_NL-mls_7432-low' | 'no_NO-talesyntese-medium' | 'pl_PL-darkman-medium' | 'pl_PL-gosia-medium' | 'pl_PL-mc_speech-medium' | 'pl_PL-mls_6892-low' | 'pt_BR-edresson-low' | 'pt_BR-faber-medium' | 'pt_PT-tugão-medium' | 'ro_RO-mihai-medium' | 'ru_RU-denis-medium' | 'ru_RU-dmitri-medium' | 'ru_RU-irina-medium' | 'ru_RU-ruslan-medium' | 'sk_SK-lili-medium' | 'sl_SI-artur-medium' | 'sr_RS-serbski_institut-medium' | 'sv_SE-nst-medium' | 'sw_CD-lanfrica-medium' | 'tr_TR-dfki-medium' | 'tr_TR-fahrettin-medium' | 'tr_TR-fettah-medium' | 'uk_UA-lada-x_low' | 'uk_UA-ukrainian_tts-medium' | 'vi_VN-25hours_single-low' | 'vi_VN-vais1000-medium' | 'vi_VN-vivos-x_low' | 'zh_CN-huayan-medium' | 'zh_CN-huayan-x_low';
export type CountryCode = 'ar_JO' | 'ca_ES' | 'cs_CZ' | 'da_DK' | 'de_DE' | 'el_GR' | 'en_GB' | 'en_US' | 'es_ES' | 'es_MX' | 'fa_IR' | 'fi_FI' | 'fr_FR' | 'hu_HU' | 'is_IS' | 'it_IT' | 'ka_GE' | 'kk_KZ' | 'lb_LU' | 'ne_NP' | 'nl_BE' | 'nl_NL' | 'no_NO' | 'pl_PL' | 'pt_BR' | 'pt_PT' | 'ro_RO' | 'ru_RU' | 'sk_SK' | 'sl_SI' | 'sr_RS' | 'sv_SE' | 'sw_CD' | 'tr_TR' | 'uk_UA' | 'vi_VN' | 'zh_CN';
export type FileKey = `${string}/${VoiceId}.onnx` | `${string}/${VoiceId}.onnx.json` | `${string}/MODEL_CARD`;
export type Quality = 'low' | 'medium' | 'x_low' | 'high';
+8 -1
View File
@@ -669,7 +669,7 @@ lodash.isequal@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==
lodash@~4.17.15:
lodash@^4.17.20, lodash@~4.17.15:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@@ -722,6 +722,13 @@ nanoid@^3.3.7:
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8"
integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==
object-deep-compare@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/object-deep-compare/-/object-deep-compare-1.2.0.tgz#f9d22a294fd5807b27b804bde15e3a2f68a55466"
integrity sha512-avtOP/QUywajg2LH01jQ8eikIiV3nwDU0Z0fvEl/vVrSg1XDY7KolblJECjEa477pocludBtexT5jW7jfrOXUw==
dependencies:
lodash "^4.17.20"
onnxruntime-common@1.18.0:
version "1.18.0"
resolved "https://registry.yarnpkg.com/onnxruntime-common/-/onnxruntime-common-1.18.0.tgz#b904dc6ff134e7f21a3eab702fac17538f59e116"