Skip to content
This repository was archived by the owner on Dec 28, 2025. It is now read-only.

Commit e3bd284

Browse files
committed
use zipfile instead of !zip
1 parent 6c9b247 commit e3bd284

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

DiffSinger_colab_notebook.ipynb

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"metadata": {
55
"colab": {
66
"provenance": [],
7+
"gpuType": "T4",
78
"collapsed_sections": [
89
"MP5rRkbTpnG8",
910
"Wv0gfI5feBSc",
@@ -20,7 +21,8 @@
2021
},
2122
"language_info": {
2223
"name": "python"
23-
}
24+
},
25+
"accelerator": "GPU"
2426
},
2527
"cells": [
2628
{
@@ -687,6 +689,7 @@
687689
"from IPython.display import clear_output\n",
688690
"clear_output()\n",
689691
"import os\n",
692+
"import zipfile\n",
690693
"#@markdown <font size=\"-1.5\"> select this if you don't want to see the onnx converter's output\n",
691694
"no_output = True # @param {type:\"boolean\"}\n",
692695
"\n",
@@ -880,8 +883,14 @@
880883
" !cp {exp_folder}/onnx/acoustic/phonemes.txt /content/OU_compatible_files/enunux_base >/dev/null 2>&1\n",
881884
" !cp {dsdict_path} /content/OU_compatible_files/enunux_base >/dev/null 2>&1 #enunux doesnt need this but it doesnt hurt to include this file with it\n",
882885
" !mv /content/OU_compatible_files/enunux_base /content/OU_compatible_files/OU_voicebank\n",
883-
" !zip {exp_folder}/OU_compatible_vb.zip /content/OU_compatible_files/OU_voicebank/* >/dev/null 2>&1\n",
884-
"\n",
886+
" folder_to_zip = \"/content/OU_compatible_files/OU_voicebank\"\n",
887+
" output_zip_filename = exp_folder + \"/OU_voicebank.zip\"\n",
888+
" with zipfile.ZipFile(output_zip_filename, 'w', zipfile.ZIP_DEFLATED) as zipf:\n",
889+
" for root, dirs, files in os.walk(folder_to_zip):\n",
890+
" for file in files:\n",
891+
" file_path = os.path.join(root, file)\n",
892+
" relative_path = os.path.relpath(file_path, folder_to_zip)\n",
893+
" zipf.write(file_path, relative_path)\n",
885894
"else:\n",
886895
" acoustic_1 = f\"{acoustic_onnx_exp}\" + \"/acoustic.onnx\"\n",
887896
" variance_1 = f\"{variance_onnx_exp}\" + \"/variance.onnx\"\n",
@@ -903,7 +912,14 @@
903912
" !rm /content/OU_compatible_files/variance_base/dsdict.yaml\n",
904913
" !cp {dsdict_path} /content/OU_compatible_files/variance_base\n",
905914
" !mv /content/OU_compatible_files/variance_base /content/OU_compatible_files/OU_voicebank\n",
906-
" !zip {exp_folder}/OU_compatible_vb.zip /content/OU_compatible_files/OU_voicebank/* >/dev/null 2>&1\n",
915+
" folder_to_zip = \"/content/OU_compatible_files/OU_voicebank\"\n",
916+
" output_zip_filename = exp_folder + \"/OU_voicebank.zip\"\n",
917+
" with zipfile.ZipFile(output_zip_filename, 'w', zipfile.ZIP_DEFLATED) as zipf:\n",
918+
" for root, dirs, files in os.walk(folder_to_zip):\n",
919+
" for file in files:\n",
920+
" file_path = os.path.join(root, file)\n",
921+
" relative_path = os.path.relpath(file_path, folder_to_zip)\n",
922+
" zipf.write(file_path, relative_path)\n",
907923
"\n",
908924
"print(\"\\n\")\n",
909925
"print(\"Go extract and edit character.txt and character.yaml to your liking for OpenUtau <3\")\n"

0 commit comments

Comments
 (0)