Minor improvements for model exporter.

This commit is contained in:
Mateo Cedillo
2023-06-12 17:12:57 -05:00
parent 2a9d86a902
commit aa195db3a8

View File

@@ -5,7 +5,7 @@
"colab": {
"provenance": [],
"gpuType": "T4",
"authorship_tag": "ABX9TyNIYQxa0c4fzWAKq19kBp4a",
"authorship_tag": "ABX9TyOULEPr6wG6WSnjG8EviQHg",
"include_colab_link": true
},
"kernelspec": {
@@ -74,9 +74,9 @@
"guideurl = \"https://github.com/rmcpantoja/piper/blob/master/notebooks/wav/en\"\n",
"#@markdown #### Download:\n",
"#@markdown **Drive ID or direct download link of the model in another cloud:**\n",
"model_id = \"\" #@param {type:\"string\"}\n",
"model_id = \"https://drive.google.com/file/d/1JmphSxbd9YxA9lRb3y5amOX8ah-ald59/view?usp=sharing\" #@param {type:\"string\"}\n",
"#@markdown **Drive ID or direct download link of the config.json file:**\n",
"config_id = \"\" #@param {type:\"string\"}\n",
"config_id = \"1-2Bh3M9oesgKibcXED7k3AALRH9yn7tM\" #@param {type:\"string\"}\n",
"#@markdown ---\n",
"\n",
"#@markdown #### Creation process:\n",
@@ -91,6 +91,7 @@
"def start_process():\n",
" if not os.path.exists(\"/content/project/model.ckpt\"):\n",
" raise Exception(\"Could not download model! make sure the file is shareable to everyone\")\n",
" output.eval_js(f'new Audio(\"{guideurl}/starting.wav?raw=true\").play()')\n",
" !python -m piper_train.export_onnx \"/content/project/model.ckpt\" \"{export_voice_path}/{export_voice_name}.onnx\"\n",
" print(\"compressing...\")\n",
" !tar -czvf \"{packages_path}/voice-{export_voice_name}.tar.gz\" -C \"{export_voice_path}\" .\n",
@@ -118,7 +119,7 @@
"else:\n",
" !wget \"{config_id}\" -O \"{export_voice_path}/{export_voice_name}.onnx.json\"\n",
"#@markdown **Do you want to write a model card?**\n",
"write_model_card = False #@param {type:\"boolean\"}\n",
"write_model_card = True #@param {type:\"boolean\"}\n",
"if write_model_card:\n",
" with open(f\"{export_voice_path}/{export_voice_name}.onnx.json\", \"r\") as file:\n",
" config = json.load(file)\n",
@@ -139,7 +140,6 @@
" text_area.close()\n",
" button.close()\n",
" output.clear()\n",
" output.eval_js(f'new Audio(\"{guideurl}/starting.wav?raw=true\").play()')\n",
" start_process()\n",
"\n",
" button.on_click(create_model_card)\n",
@@ -161,7 +161,7 @@
"#@title Download/export your generated voice package\n",
"\n",
"#@markdown #### How do you want to export your model?\n",
"export_mode = \"Download the voice package on my device (may take some time)\" #@param [\"Download the voice package on my device (may take some time)\", \"upload it to my Google Drive\"]\n",
"export_mode = \"upload it to my Google Drive\" #@param [\"Download the voice package on my device (may take some time)\", \"upload it to my Google Drive\"]\n",
"print(\"Exporting package...\")\n",
"if export_mode == \"Download the voice package on my device (may take some time)\":\n",
" from google.colab import files\n",