Skip to content

Commit 5d25c72

Browse files
committed
Revert "Merge branch 'main' into dev-main-backup"
This reverts commit 81fd2a0, reversing changes made to 521f5fb.
1 parent 81fd2a0 commit 5d25c72

8 files changed

+233
-270
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# 7/25 Changelog:
2-
- Better MacOS installation script. For inference, all that needs to be done is running the `run.sh` from the extracted zip folder, where it will install Python 3.8, Homebrew, and other dependencies for you automatically. M1 Macs are natively supported for GPU acceleration, and training should work if you choose to download the pretrained models.
2+
- Fixed the cli inferencing traceback.
3+
- SQL Databases implemented for formanting training stop.
4+
- Gradio browser tab renamed to `Mangio-RVC-Web 💻`.
5+
- Rudimentary functions from `infer-web.py` removed.
6+
- Formanting now accepts any audio format, as long as it is supported by FFmpeg.
7+
38

49
# 7/23 Changelog:
510
- Fp16 detection now works how it did before the last RVC beta; no more training slowdowns compared to how it was before then

extract_f0_print.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@
1919

2020
DoFormant = False
2121

22-
with open("formanting.txt", "r") as fvf:
23-
content = fvf.readlines()
24-
Quefrency, Timbre = content[1].split("\n")[0], content[2].split("\n")[0]
25-
22+
Quefrency = 0.0
23+
Timbre = 0.0
2624

2725
def printt(strr):
2826
print(strr)

formanting.txt

-3
This file was deleted.

infer-web.py

+186-138
Large diffs are not rendered by default.

my_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,4 @@ def load_audio(file, sr, DoFormant, Quefrency, Timbre):
105105
converted = False
106106

107107
conn.close()
108-
return np.frombuffer(out, np.float32).flatten()
108+
return np.frombuffer(out, np.float32).flatten()

run.sh

+2-98
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
#!/bin/bash
22

3-
# Define common paths for Homebrew
4-
BREW_PATHS=(
5-
"/usr/local/bin"
6-
"/opt/homebrew/bin"
7-
)
8-
93
if [[ "$(uname)" == "Darwin" ]]; then
104
# macOS specific env:
115
export PYTORCH_ENABLE_MPS_FALLBACK=1
@@ -17,74 +11,6 @@ fi
1711

1812
requirements_file="requirements.txt"
1913

20-
# Function to add a path to PATH
21-
add_to_path() {
22-
echo "Homebrew found in $1, which is not in your PATH."
23-
read -p "Do you want to add this path to your PATH? (y/n) " -n 1 -r
24-
echo
25-
if [[ $REPLY =~ ^[Yy]$ ]]; then
26-
echo "Adding $1 to PATH..."
27-
28-
# Detect the shell and choose the right profile file
29-
local shell_profile
30-
if [[ $SHELL == *"/bash"* ]]; then
31-
shell_profile="$HOME/.bashrc"
32-
[[ ! -f "$shell_profile" ]] && shell_profile="$HOME/.bash_profile"
33-
elif [[ $SHELL == *"/zsh"* ]]; then
34-
shell_profile="$HOME/.zshrc"
35-
else
36-
echo "Unsupported shell. Please add the following line to your shell profile file manually:"
37-
echo "export PATH=\"$PATH:$1\""
38-
return
39-
fi
40-
41-
# Add the export line to the shell profile file
42-
echo "export PATH=\"$PATH:$1\"" >> "$shell_profile"
43-
44-
# Source the shell profile file
45-
source "$shell_profile"
46-
47-
# Verify that the new PATH includes Homebrew
48-
if ! command -v brew &> /dev/null; then
49-
echo "Failed to add Homebrew to the PATH."
50-
fi
51-
fi
52-
}
53-
54-
# Check if Homebrew is in PATH
55-
if command -v brew &> /dev/null; then
56-
echo "Homebrew is already in your PATH."
57-
else
58-
# If not, check common paths for Homebrew
59-
echo "Homebrew not found in PATH. Checking common paths..."
60-
for path in "${BREW_PATHS[@]}"; do
61-
if [[ -x "$path/brew" ]]; then
62-
add_to_path "$path"
63-
break
64-
fi
65-
done
66-
fi
67-
68-
# Check again if Homebrew is in PATH
69-
if ! command -v brew &> /dev/null; then
70-
echo "Homebrew still not found. Attempting to install..."
71-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
72-
fi
73-
74-
# Verifying if Homebrew has been installed successfully
75-
if command -v brew &> /dev/null; then
76-
echo "Homebrew installed successfully."
77-
else
78-
echo "Homebrew installation failed."
79-
exit 1
80-
fi
81-
82-
# Installing ffmpeg with Homebrew
83-
if [[ "$(uname)" == "Darwin" ]]; then
84-
echo "Installing ffmpeg..."
85-
brew install ffmpeg
86-
fi
87-
8814
# Check if Python 3.8 is installed
8915
if ! command -v python3.8 &> /dev/null; then
9016
echo "Python 3.8 not found. Attempting to install..."
@@ -101,7 +27,7 @@ fi
10127

10228
# Check if required packages are installed and install them if not
10329
if [ -f "${requirements_file}" ]; then
104-
installed_packages=$(python3.8 -m pip list --format=freeze)
30+
installed_packages=$(python3.8 -m pip freeze)
10531
while IFS= read -r package; do
10632
[[ "${package}" =~ ^#.* ]] && continue
10733
package_name=$(echo "${package}" | sed 's/[<>=!].*//')
@@ -115,27 +41,5 @@ else
11541
exit 1
11642
fi
11743

118-
# Install onnxruntime package
119-
echo "Installing onnxruntime..."
120-
python3.8 -m pip install onnxruntime
121-
122-
download_if_not_exists() {
123-
local filename=$1
124-
local url=$2
125-
if [ ! -f "$filename" ]; then
126-
echo "$filename does not exist, downloading..."
127-
curl -# -L -o "$filename" "$url"
128-
echo "Download finished."
129-
else
130-
echo "$filename already exists."
131-
fi
132-
}
133-
134-
# Check and download hubert_base.pt
135-
download_if_not_exists "hubert_base.pt" "https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt"
136-
137-
# Check and download rmvpe.pt
138-
download_if_not_exists "rmvpe.pt" "https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/rmvpe.pt"
139-
14044
# Run the main script
141-
python3.8 infer-web.py --pycmd python3.8
45+
python3.8 infer-web.py --pycmd python3.8

stop.txt

Whitespace-only changes.

train_nsf_sim_cache_sid_load_pretrain.py

+36-25
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
DistributedBucketSampler,
3434
)
3535

36+
import sqlite3
37+
3638
if hps.version == "v1":
3739
from lib.infer_pack.models import (
3840
SynthesizerTrnMs256NSFsid as RVC_Model_f0,
@@ -254,6 +256,7 @@ def run(rank, n_gpus, hps):
254256
def train_and_evaluate(
255257
rank, epoch, hps, nets, optims, schedulers, scaler, loaders, logger, writers, cache
256258
):
259+
257260
net_g, net_d = nets
258261
optim_g, optim_d = optims
259262
train_loader, eval_loader = loaders
@@ -350,6 +353,10 @@ def train_and_evaluate(
350353

351354
# Run steps
352355
epoch_recorder = EpochRecorder()
356+
357+
conn = sqlite3.connect('TEMP/db:cachedb?mode=memory&cache=shared', check_same_thread=False)
358+
cursor = conn.cursor()
359+
353360
for batch_idx, info in data_iterator:
354361
# Data
355362
## Unpack
@@ -568,33 +575,33 @@ def train_and_evaluate(
568575
),
569576
)
570577
)
571-
572-
with open("stop.txt", "r+") as tostop:
573-
content = tostop.read()
574-
if "stop" in content:
575-
logger.info("Stop Button was pressed. The program is closed.")
576-
if hasattr(net_g, "module"):
577-
ckpt = net_g.module.state_dict()
578-
else:
579-
ckpt = net_g.state_dict()
580-
logger.info(
581-
"saving final ckpt:%s"
582-
% (
583-
savee(
584-
ckpt,
585-
hps.sample_rate,
586-
hps.if_f0,
587-
hps.name,
588-
epoch,
589-
hps.version,
590-
hps,
591-
)
578+
579+
cursor.execute("SELECT stop FROM stop_train LIMIT 1")
580+
if bool(cursor.fetchone()) == True:
581+
logger.info("Stop Button was pressed. The program is closed.")
582+
if hasattr(net_g, "module"):
583+
ckpt = net_g.module.state_dict()
584+
else:
585+
ckpt = net_g.state_dict()
586+
logger.info(
587+
"saving final ckpt:%s"
588+
% (
589+
savee(
590+
ckpt,
591+
hps.sample_rate,
592+
hps.if_f0,
593+
hps.name,
594+
epoch,
595+
hps.version,
596+
hps,
592597
)
593598
)
594-
595-
tostop.truncate(0)
596-
tostop.writelines("not")
597-
os._exit(2333333)
599+
)
600+
sleep(1)
601+
cursor.execute("DELETE FROM stop_train")
602+
conn.commit()
603+
conn.close()
604+
os._exit(2333333)
598605

599606
if rank == 0:
600607
logger.info("====> Epoch: {} {}".format(epoch, epoch_recorder.record()))
@@ -614,7 +621,11 @@ def train_and_evaluate(
614621
)
615622
)
616623
sleep(1)
624+
cursor.execute("DELETE FROM stop_train")
625+
conn.commit()
626+
conn.close()
617627
os._exit(2333333)
628+
618629

619630

620631
if __name__ == "__main__":

0 commit comments

Comments
 (0)