From f119993fb5724dafe0e68cf0da360f3ab6c2f61d Mon Sep 17 00:00:00 2001 From: mrq Date: Tue, 21 Feb 2023 20:20:52 +0000 Subject: [PATCH] explicitly use python3 because some OSs will not have python alias to python3, allow batch size 1 --- setup-cuda.sh | 13 +++++++------ setup-rocm.sh | 12 ++++++------ src/utils.py | 11 +++++++---- update.sh | 12 ++++++------ 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/setup-cuda.sh b/setup-cuda.sh index f17706e..3da2a1e 100755 --- a/setup-cuda.sh +++ b/setup-cuda.sh @@ -2,12 +2,13 @@ git submodule init git submodule update -python -m venv venv +python3 -m venv venv source ./venv/bin/activate -python -m pip install --upgrade pip +python3 -m pip install --upgrade pip +# CUDA pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116 -python -m pip install -r ./dlas/requirements.txt -python -m pip install -r ./tortoise-tts/requirements.txt -python -m pip install -r ./requirements.txt -python -m pip install -e ./tortoise-tts/ +python3 -m pip install -r ./dlas/requirements.txt +python3 -m pip install -r ./tortoise-tts/requirements.txt +python3 -m pip install -r ./requirements.txt +python3 -m pip install -e ./tortoise-tts/ deactivate diff --git a/setup-rocm.sh b/setup-rocm.sh index 9017346..302d65e 100755 --- a/setup-rocm.sh +++ b/setup-rocm.sh @@ -2,13 +2,13 @@ git submodule init git submodule update -python -m venv venv +python3 -m venv venv source ./venv/bin/activate -python -m pip install --upgrade pip +python3 -m pip install --upgrade pip # ROCM pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/rocm5.1.1 # 5.2 does not work for me desu -python -m pip install -r ./dlas/requirements.txt -python -m pip install -r ./tortoise-tts/requirements.txt -python -m pip install -r ./requirements.txt -python -m pip install -e ./tortoise-tts/ +python3 -m pip install -r ./dlas/requirements.txt +python3 -m pip install -r ./tortoise-tts/requirements.txt +python3 -m pip install -r ./requirements.txt +python3 -m pip install -e ./tortoise-tts/ deactivate diff --git a/src/utils.py b/src/utils.py index c75d47a..970804d 100755 --- a/src/utils.py +++ b/src/utils.py @@ -575,14 +575,17 @@ def optimize_training_settings( epochs, batch_size, learning_rate, learning_rate batch_size = lines messages.append(f"Batch size is larger than your dataset, clamping batch size to: {batch_size}") - if batch_size / mega_batch_factor < 2: - mega_batch_factor = int(batch_size / 2) - messages.append(f"Mega batch factor is too large for the given batch size, clamping mega batch factor to: {mega_batch_factor}") - if batch_size % lines != 0: nearest_slice = int(lines / batch_size) + 1 batch_size = int(lines / nearest_slice) messages.append(f"Batch size not neatly divisible by dataset size, adjusting batch size to: {batch_size} ({nearest_slice} steps per epoch)") + + if batch_size == 1 and mega_batch_factor != 1: + mega_batch_factor = 1 + messages.append(f"Mega batch factor is too large for the given batch size, clamping mega batch factor to: {mega_batch_factor}") + elif batch_size / mega_batch_factor < 2: + mega_batch_factor = int(batch_size / 2) + messages.append(f"Mega batch factor is too large for the given batch size, clamping mega batch factor to: {mega_batch_factor}") iterations = calc_iterations(epochs=epochs, lines=lines, batch_size=batch_size) diff --git a/update.sh b/update.sh index fa6652b..58d852b 100755 --- a/update.sh +++ b/update.sh @@ -2,14 +2,14 @@ git pull git submodule update -python -m venv venv +python3 -m venv venv source ./venv/bin/activate -python -m pip install --upgrade pip -python -m pip install -r ./dlas/requirements.txt -python -m pip install -r ./tortoise-tts/requirements.txt -python -m pip install -e ./tortoise-tts -python -m pip install -r ./requirements.txt +python3 -m pip install --upgrade pip +python3 -m pip install -r ./dlas/requirements.txt +python3 -m pip install -r ./tortoise-tts/requirements.txt +python3 -m pip install -e ./tortoise-tts +python3 -m pip install -r ./requirements.txt deactivate \ No newline at end of file