Merge branch 'colab' into dev

This commit is contained in:
litagin02
2023-12-30 18:45:53 +09:00
13 changed files with 154 additions and 22 deletions

View File

@@ -10,10 +10,24 @@ import yaml
from tools.log import logger
from tools.subprocess_utils import run_script_with_log, second_elem_of
try:
import google.colab
IS_COLAB = True
except ImportError:
IS_COLAB = False
def get_path(model_name):
assert model_name != "", "モデル名は空にできません"
dataset_path = os.path.join("Data", model_name)
if IS_COLAB:
logger.info("Colab detected, so use mounted Google Drive as dataset path:")
dataset_path = os.path.join(
"/content/drive/MyDrive/Style-Bert-VITS2/Data", model_name
)
logger.info(dataset_path)
else:
dataset_path = os.path.join("Data", model_name)
lbl_path = os.path.join(dataset_path, "esd.list")
train_path = os.path.join(dataset_path, "train.list")
val_path = os.path.join(dataset_path, "val.list")
@@ -39,9 +53,12 @@ def initialize(model_name, batch_size, epochs, save_every_steps, bf16_run):
model_path = os.path.join(dataset_path, "models")
try:
shutil.copytree(src="pretrained", dst=model_path)
shutil.copytree(
src="pretrained",
dst=model_path,
)
except FileExistsError:
logger.error(f"Step 1: {model_path} already exists.")
logger.warning(f"Step 1: {model_path} already exists.")
return False, f"Step1, Error: モデルフォルダ {model_path} が既に存在します。問題なければ削除してください。"
except FileNotFoundError:
logger.error("Step 1: `pretrained` folder not found.")