Skip to content

Commit

Permalink
Better fix training
Browse files Browse the repository at this point in the history
  • Loading branch information
aitronz committed Jan 26, 2024
1 parent 2e359c6 commit 81fa5e8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 53 deletions.
4 changes: 4 additions & 0 deletions assets/i18n/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"Model Name": "Model Name",
"Enter model name": "Enter model name",
"Dataset Path": "Dataset Path",
"Dataset Creator": "Dataset Creator",
"Dataset Name": "Dataset Name",
"Enter dataset name": "Enter dataset name",
"Upload Audio Dataset": "Upload Audio Dataset",
"The audio file has been successfully added to the dataset. Please click the preprocess button.": "The audio file has been successfully added to the dataset. Please click the preprocess button.",
"Enter dataset path": "Enter dataset path",
"Sampling Rate": "Sampling Rate",
Expand Down
4 changes: 4 additions & 0 deletions assets/i18n/languages/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"Model Name": "Nombre del modelo",
"Enter model name": "Introduzca el nombre del modelo",
"Dataset Path": "Ruta del dataset",
"Dataset Creator": "Creador de datasets",
"Dataset Name": "Nombre del dataset",
"Enter dataset name": "Introduce el nombre de tu dataset",
"Upload Audio Dataset": "Sube el audio del dataset",
"Enter dataset path": "Introduzca la ruta del dataset",
"Sampling Rate": "Frecuencia de muestreo",
"RVC Version": "Versión RVC",
Expand Down
20 changes: 10 additions & 10 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ def run_train_script(
g_pretrained_path=None,
d_pretrained_path=None,
):
f0 = 1 if pitch_guidance == "True" else 0
latest = 1 if save_only_latest == "True" else 0
save_every = 1 if save_every_weights == "True" else 0
f0 = 1 if str(pitch_guidance) == "True" else 0
latest = 1 if str(save_only_latest) == "True" else 0
save_every = 1 if str(save_every_weights) == "True" else 0

if pretrained == "True":
if custom_pretrained == "False":
if str(pretrained) == "True":
if str(custom_pretrained) == "False":
pg, pd = pretrained_selector(f0)[rvc_version][sampling_rate]
else:
if g_pretrained_path is None or d_pretrained_path is None:
Expand All @@ -246,25 +246,25 @@ def run_train_script(
train_script_path = os.path.join("rvc", "train", "train.py")
command = [
"python",
train_script_path,
str(train_script_path),
"-se",
str(save_every_epoch),
"-te",
str(total_epoch),
"-pg",
pg,
str(pg),
"-pd",
pd,
str(pd),
"-sr",
str(sampling_rate),
"-bs",
str(batch_size),
"-g",
gpu,
str(gpu),
"-e",
os.path.join(logs_path, str(model_name)),
"-v",
rvc_version,
str(rvc_version),
"-l",
str(latest),
"-c",
Expand Down
49 changes: 6 additions & 43 deletions tabs/train/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,46 +84,6 @@ def refresh_datasets():
return {"choices": sorted(get_datasets_list()), "__type__": "update"}


# Train Temporal Fix
def run_train(
model_name,
rvc_version,
save_every_epoch,
save_only_latest,
save_every_weights,
total_epoch,
sampling_rate,
batch_size,
gpu,
pitch_guidance,
pretrained,
custom_pretrained,
g_pretrained_path,
d_pretrained_path,
):
core = os.path.join("core.py")
command = [
"python",
core,
"train",
str(model_name),
str(rvc_version),
str(save_every_epoch),
str(save_only_latest),
str(save_every_weights),
str(total_epoch),
str(sampling_rate),
str(batch_size),
str(gpu),
str(pitch_guidance),
str(pretrained),
str(custom_pretrained),
str(g_pretrained_path),
str(d_pretrained_path),
]
subprocess.run(command)


# Drop Model
def save_drop_model(dropbox):
if ".pth" not in dropbox:
Expand Down Expand Up @@ -170,7 +130,10 @@ def save_drop_dataset_audio(dropbox, dataset_name):
"The audio file has been successfully added to the dataset. Please click the preprocess button."
)
)
return None, destination_path
dataset_path = os.path.dirname(destination_path)
relative_dataset_path = os.path.relpath(dataset_path, now_dir)

return None, relative_dataset_path


# Train Tab
Expand All @@ -193,7 +156,7 @@ def train_tab():
)
refresh_datasets_button = gr.Button(i18n("Refresh Datasets"))
dataset_creator = gr.Checkbox(
label=i18n("Dataset Advanced Settings"),
label=i18n("Dataset Creator"),
value=False,
interactive=True,
visible=True,
Expand Down Expand Up @@ -357,7 +320,7 @@ def train_tab():
with gr.Row():
train_button = gr.Button(i18n("Start Training"))
train_button.click(
run_train,
run_train_script,
[
model_name,
rvc_version,
Expand Down

0 comments on commit 81fa5e8

Please sign in to comment.