Cleaned Some Cells

This commit is contained in:
Hina 2023-11-13 01:25:20 +08:00
parent da9e6aaf6b
commit 53ea4cef57

View File

@ -158,26 +158,22 @@
"cell_type": "code",
"source": [
"\n",
"#@title #**[Optional]** Upload a voice model (Run this before running the Voice Changer)\n",
"#@markdown ---\n",
"#@title **[Optional]** Upload a voice model (Run this before running the Voice Changer)\n",
"import os\n",
"import json\n",
"from IPython.display import Image\n",
"\n",
"\n",
"#@markdown #Model Number `(Default is 0)` you can add multiple models as long as you change the number!\n",
"model_number = \"0\" #@param ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100', '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115', '116', '117', '118', '119', '120', '121', '122', '123', '124', '125', '126', '127', '128', '129', '130', '131', '132', '133', '134', '135', '136', '137', '138', '139', '140', '141', '142', '143', '144', '145', '146', '147', '148', '149', '150', '151', '152', '153', '154', '155', '156', '157', '158', '159', '160', '161', '162', '163', '164', '165', '166', '167', '168', '169', '170', '171', '172', '173', '174', '175', '176', '177', '178', '179', '180', '181', '182', '183', '184', '185', '186', '187', '188', '189', '190', '191', '192', '193', '194', '195', '196', '197', '198', '199']\n",
"model_slot = \"0\" #@param ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100', '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115', '116', '117', '118', '119', '120', '121', '122', '123', '124', '125', '126', '127', '128', '129', '130', '131', '132', '133', '134', '135', '136', '137', '138', '139', '140', '141', '142', '143', '144', '145', '146', '147', '148', '149', '150', '151', '152', '153', '154', '155', '156', '157', '158', '159', '160', '161', '162', '163', '164', '165', '166', '167', '168', '169', '170', '171', '172', '173', '174', '175', '176', '177', '178', '179', '180', '181', '182', '183', '184', '185', '186', '187', '188', '189', '190', '191', '192', '193', '194', '195', '196', '197', '198', '199']\n",
"\n",
"!rm -rf model_dir/$model_number\n",
"#@markdown ---\n",
"#@markdown #**[Optional]** Add an icon to the model `(can be any image/leave empty for no image)`\n",
"icon_link = \"https://cdn.discordapp.com/attachments/1144453160912572506/1144453161210351697/mika.png?ex=65163190&is=6514e010&hm=6cfc987d42e448b2912f5225e2c865df92d688c8dc46a135c2cca32682a3f3ea&\" #@param {type:\"string\"}\n",
"#@markdown ---\n",
"!rm -rf model_dir/$model_slot\n",
"#@markdown **[Optional]** Add an icon to the model\n",
"icon_link = \"https://static.wikia.nocookie.net/virtualyoutuber/images/8/8b/ShyreiProfile.png\" #@param {type:\"string\"}\n",
"icon_link = '\"'+icon_link+'\"'\n",
"!mkdir model_dir\n",
"!mkdir model_dir/$model_number\n",
"#@markdown #Put your model's download link here `(must be a zip file)`\n",
"model_link = \"https://huggingface.co/Kit-Lemonfoot/kitlemonfoot_rvc_models/resolve/main/Mika%20Melatika%20(Speaking)(KitLemonfoot).zip\" #@param {type:\"string\"}\n",
"!mkdir model_dir/$model_slot\n",
"#@markdown Put your model's download link here `(must be a zip file)`\n",
"model_link = \"https://huggingface.co/RavenCutie21/Models/resolve/main/SquChan_e800_20800steps.zip?download=true\" #@param {type:\"string\"}\n",
"model_link = '\"'+model_link+'\"'\n",
"!curl -L $model_link > model.zip\n",
"\n",
@ -185,41 +181,35 @@
"# Conditionally set the iconFile based on whether icon_link is empty\n",
"if icon_link:\n",
" iconFile = \"icon.png\"\n",
" !curl -L $icon_link > model_dir/$model_number/icon.png\n",
" !curl -L $icon_link > model_dir/$model_slot/icon.png\n",
"else:\n",
" iconFile = \"\"\n",
" print(\"icon_link is empty, so no icon file will be downloaded.\")\n",
"#@markdown ---\n",
"\n",
"\n",
"!unzip model.zip -d model_dir/$model_number\n",
"!unzip model.zip -d model_dir/$model_slot\n",
"\n",
"# Checks all the files in model_number and puts it outside of it\n",
"# Checks all the files in model_slot and puts it outside of it\n",
"\n",
"!mv model_dir/$model_number/*/* model_dir/$model_number/\n",
"!rm -rf model_dir/$model_number/*/\n",
"!mv model_dir/$model_slot/*/* model_dir/$model_slot/\n",
"!rm -rf model_dir/$model_slot/*/\n",
"\n",
"# if theres a folder in the number,\n",
"# take all the files in the folder and put it outside of that folder\n",
"\n",
"\n",
"#@markdown #**Model Voice Convertion Setting**\n",
"#@markdown Tune `-12=F-M`**||**`0=M-M/F-F`**||**`12=M-F`\n",
"#@markdown **Model Voice Convertion Setting**\n",
"Tune = 12 #@param {type:\"slider\",min:-50,max:50,step:1}\n",
"#@markdown Index `0=Default`**||**`1=Replicate Accent`\n",
"Index = 0 #@param {type:\"slider\",min:0,max:1,step:0.1}\n",
"#@markdown ---\n",
"\n",
"# @markdown #**[Optional]** Parameter file for your voice model\n",
"#@markdown _(must be named params.json)_ (Leave Empty for Default)\n",
"param_link = \"\" #@param {type:\"string\"}\n",
"param_link = \"\"\n",
"if param_link == \"\":\n",
" from voice_changer.RVC.RVCModelSlotGenerator import RVCModelSlotGenerator\n",
" from voice_changer.VoiceChangerParamsManager import VoiceChangerParamsManager\n",
" from voice_changer.utils.LoadModelParams import LoadModelParamFile, LoadModelParams\n",
" from voice_changer.utils.VoiceChangerParams import VoiceChangerParams\n",
"\n",
" model_dir1 = \"model_dir/\"+model_number+\"/\"\n",
" model_dir1 = \"model_dir/\"+model_slot+\"/\"\n",
"\n",
" is_pth = True # Set this to True if you want to search for .pth files, or False for .onnx files\n",
" file_extension = \".pth\" if is_pth else \".onnx\"\n",
@ -249,7 +239,7 @@
"\n",
" print(model_name)\n",
" voiceChangerParams = VoiceChangerParams(\n",
" model_dir=\"./model_dir/\"+model_number,\n",
" model_dir=\"./model_dir/\"+model_slot,\n",
" content_vec_500=\"\",\n",
" content_vec_500_onnx=\"\",\n",
" content_vec_500_onnx_on=\"\",\n",
@ -319,8 +309,7 @@
"\n",
"# !unzip model.zip -d model_dir/0/\n",
"clear_output()\n",
"print(\"\\033[92mModel with the name of \"+model_name+\" has been Imported to slot \"+model_number)\n",
"Image(url=icon_link)"
"print(\"\\033[92mModel with the name of \"+model_name+\" has been Imported to slot \"+model_slot)"
],
"metadata": {
"id": "_ZtbKUVUgN3G",
@ -329,25 +318,6 @@
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"#@title Delete a model `[Only Use When Needed]`\n",
"#@markdown ---\n",
"#@markdown Select which slot you want to delete\n",
"Delete_Slot = \"198\" #@param ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100', '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115', '116', '117', '118', '119', '120', '121', '122', '123', '124', '125', '126', '127', '128', '129', '130', '131', '132', '133', '134', '135', '136', '137', '138', '139', '140', '141', '142', '143', '144', '145', '146', '147', '148', '149', '150', '151', '152', '153', '154', '155', '156', '157', '158', '159', '160', '161', '162', '163', '164', '165', '166', '167', '168', '169', '170', '171', '172', '173', '174', '175', '176', '177', '178', '179', '180', '181', '182', '183', '184', '185', '186', '187', '188', '189', '190', '191', '192', '193', '194', '195', '196', '197', '198', '199']\n",
"# {type:\"slider\",min:0,max:1,step:0.1}\n",
"\n",
"!rm -rf model_dir/$Model_Number\n",
"print(\"\\033[92mSuccessfully removed Model is slot \"+Delete_Slot)\n"
],
"metadata": {
"id": "P9g6rG1-KUwt",
"cellView": "form"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"execution_count": null,
@ -369,7 +339,7 @@
"# @markdown **1** - Create a <font color=green>**free**</font> account at [ngrok](https://dashboard.ngrok.com/signup) or **login with Google/Github account**\\\n",
"# @markdown **2** - If you didn't logged in with Google/Github, you will need to **verify your e-mail**!\\\n",
"# @markdown **3** - Click [this link](https://dashboard.ngrok.com/get-started/your-authtoken) to get your auth token, and place it here:\n",
"Token = '' # @param {type:\"string\"}\n",
"Token = 'TOKEN_HERE' # @param {type:\"string\"}\n",
"# @markdown **4** - *(optional)* Change to a region near to you or keep at United States if increase latency\\\n",
"# @markdown `Default Region: us - United States (Ohio)`\n",
"Region = \"us - United States (Ohio)\" # @param [\"ap - Asia/Pacific (Singapore)\", \"au - Australia (Sydney)\",\"eu - Europe (Frankfurt)\", \"in - India (Mumbai)\",\"jp - Japan (Tokyo)\",\"sa - South America (Sao Paulo)\", \"us - United States (Ohio)\"]\n",