From 6a5f5e89be7943d9ded0573bb76cf419beafef20 Mon Sep 17 00:00:00 2001 From: SayanoAI <28544690+SayanoAI@users.noreply.github.com> Date: Sun, 25 Aug 2024 13:38:24 -0400 Subject: [PATCH] refactored rvc_nodes --- __init__.py | 2 +- custom_nodes/{rvc.py => rvc_nodes.py} | 11 +-- examples/rvc-model-trainer.json | 99 ++++++++------------------- 3 files changed, 38 insertions(+), 74 deletions(-) rename custom_nodes/{rvc.py => rvc_nodes.py} (97%) diff --git a/__init__.py b/__init__.py index 45ac1ea..7a51e8a 100644 --- a/__init__.py +++ b/__init__.py @@ -1,7 +1,7 @@ from .custom_nodes.audio_nodes import NODE_CLASS_MAPPINGS as audio_nodes, NODE_DISPLAY_NAME_MAPPINGS as audio_nodes_name from .custom_nodes.stt import NODE_CLASS_MAPPINGS as stt_nodes, NODE_DISPLAY_NAME_MAPPINGS as stt_nodes_name from .custom_nodes.uvr import UVR5Node -from .custom_nodes.rvc import NODE_CLASS_MAPPINGS as rvc_nodes, NODE_DISPLAY_NAME_MAPPINGS as rvc_nodes_name +from .custom_nodes.rvc_nodes import NODE_CLASS_MAPPINGS as rvc_nodes, NODE_DISPLAY_NAME_MAPPINGS as rvc_nodes_name from .custom_nodes.utility_nodes import NODE_CLASS_MAPPINGS as utility_nodes, NODE_DISPLAY_NAME_MAPPINGS as utility_nodes_name from .custom_nodes.musetalk_nodes import NODE_CLASS_MAPPINGS as musetalk_nodes, NODE_DISPLAY_NAME_MAPPINGS as musetalk_nodes_name # Set the web directory, any .js file in that directory will be loaded by the frontend as a frontend extension diff --git a/custom_nodes/rvc.py b/custom_nodes/rvc_nodes.py similarity index 97% rename from custom_nodes/rvc.py rename to custom_nodes/rvc_nodes.py index f4b2a94..d67fcca 100644 --- a/custom_nodes/rvc.py +++ b/custom_nodes/rvc_nodes.py @@ -260,7 +260,7 @@ class RVCProcessDatasetNode: filelist_path = os.path.join(model_log_dir, "filelist.txt") if not os.path.isfile(filelist_path): - dataset_dir = os.path.join(input_path,"datasets",cache_name) + dataset_dir = os.path.join(input_path,"datasets",dataset.split(".")[0]) if dataset.endswith("zip"): files = extract_zip_without_structure(os.path.join(dataset_path,dataset),dataset_dir) @@ -381,7 +381,8 @@ class RVCTrainModelNode: if_cache_gpu=("BOOLEAN",{"default":True}), if_save_every_weights=("BOOLEAN",{"default":False}), train_index=("BOOLEAN",{"default": True}), - rerun=("BOOLEAN",{"default": False}), + retrain=("BOOLEAN",{"default": False}), + save_best_model=("BOOLEAN",{"default": True}) ) } @@ -406,7 +407,8 @@ class RVCTrainModelNode: if_cache_gpu=True, if_save_every_weights=False, train_index=True, - rerun=False): + retrain=False, + save_best_model=True): sample_rate = rvc_dataset_pipe["sample_rate"] name = rvc_dataset_pipe["name"] @@ -433,10 +435,11 @@ class RVCTrainModelNode: hparams.save_every_weights = if_save_every_weights hparams.if_cache_data_in_gpu = if_cache_gpu hparams.data.training_files = rvc_dataset_pipe["training_files"] + hparams.save_best_model = save_best_model file_index = self.train_index(model_dir, sample_rate, name) if train_index else None model_path = os.path.join(BASE_MODELS_DIR,"RVC",f"{name}.pth") - if os.path.isfile(model_path) and rerun: model_path = increment_filename_no_overwrite(model_path) + if os.path.isfile(model_path) and retrain: model_path = increment_filename_no_overwrite(model_path) hparams.model_path = model_path if not os.path.isfile(model_path): train_model(hparams) diff --git a/examples/rvc-model-trainer.json b/examples/rvc-model-trainer.json index bde303f..bb54b71 100644 --- a/examples/rvc-model-trainer.json +++ b/examples/rvc-model-trainer.json @@ -14,7 +14,7 @@ "1": 178 }, "flags": {}, - "order": 1, + "order": 2, "mode": 0, "outputs": [ { @@ -31,7 +31,7 @@ "Node name for S&R": "LoadPitchExtractionParams" }, "widgets_values": [ - "mangio-crepe", + "rmvpe+", false, 0.75, 0, @@ -78,10 +78,10 @@ 945.4000799560547, -349.9999832153321 ], - "size": [ - 418.1999816894531, - 166 - ], + "size": { + "0": 418.1999816894531, + "1": 166 + }, "flags": {}, "order": 6, "mode": 0, @@ -124,27 +124,7 @@ "widgets_values": [ 0, "flac", - true, - { - "hidden": false, - "paused": false, - "params": {} - }, - { - "hidden": false, - "paused": false, - "params": {} - }, - { - "hidden": false, - "paused": false, - "params": {} - }, - { - "hidden": false, - "paused": false, - "params": {} - } + true ] }, { @@ -159,7 +139,7 @@ "1": 146 }, "flags": {}, - "order": 2, + "order": 1, "mode": 0, "outputs": [ { @@ -205,7 +185,7 @@ "1": 150 }, "flags": {}, - "order": 4, + "order": 3, "mode": 0, "inputs": [ { @@ -251,10 +231,10 @@ 1431.4000799560547, -346.9999832153321 ], - "size": [ - 315, - 166 - ], + "size": { + "0": 315, + "1": 166 + }, "flags": {}, "order": 7, "mode": 0, @@ -302,27 +282,7 @@ "widgets_values": [ "None", "median", - true, - { - "hidden": false, - "paused": false, - "params": {} - }, - { - "hidden": false, - "paused": false, - "params": {} - }, - { - "hidden": false, - "paused": false, - "params": {} - }, - { - "hidden": false, - "paused": false, - "params": {} - } + true ] }, { @@ -337,7 +297,7 @@ "1": 294 }, "flags": {}, - "order": 3, + "order": 4, "mode": 0, "inputs": [ { @@ -372,8 +332,8 @@ 1, 3, 0.3, - 1, 0.9500000000000001, + 0.75, 0.01, "image" ] @@ -387,7 +347,7 @@ ], "size": { "0": 506.4000244140625, - "1": 358 + "1": 382 }, "flags": {}, "order": 5, @@ -406,8 +366,8 @@ "links": [ 23 ], - "shape": 3, - "slot_index": 0 + "slot_index": 0, + "shape": 3 }, { "name": "model_name", @@ -421,8 +381,8 @@ "links": [ 24 ], - "shape": 3, - "slot_index": 2 + "slot_index": 2, + "shape": 3 }, { "name": "pitch_extraction_params", @@ -430,8 +390,8 @@ "links": [ 25 ], - "shape": 3, - "slot_index": 3 + "slot_index": 3, + "shape": 3 } ], "properties": { @@ -440,7 +400,7 @@ "widgets_values": [ "0", 4, - 100, + 300, 0, "pretrained_v2/f0Ov2Super40kD.pth", "pretrained_v2/f0Ov2Super40kG.pth", @@ -448,7 +408,8 @@ true, false, true, - false + true, + true ] } ], @@ -541,7 +502,7 @@ -413, 45, 1303, - 442 + 466 ], "color": "#b06634", "font_size": 24 @@ -561,10 +522,10 @@ "config": {}, "extra": { "ds": { - "scale": 0.6209213230591552, + "scale": 1.1, "offset": [ - 674.1301313489, - 690.0930429150515 + 652.4400126183286, + 108.78821868462816 ] } },