Skip to content

Commit b2a67a5

Browse files
committed
Merge branch 'dev-main-backup' of https://github.com/alexlnkp/Mangio-RVC-Tweaks into dev-main-backup
2 parents 43ee908 + e20cbe7 commit b2a67a5

File tree

2 files changed

+101
-3
lines changed

2 files changed

+101
-3
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# 7/25 Changelog:
1+
# 7/26 Changelog:
22
- Fixed the cli inferencing traceback.
33
- SQL Databases implemented for formanting training stop.
44
- Gradio browser tab renamed to `Mangio-RVC-Web 💻`.
55
- Rudimentary functions from `infer-web.py` removed.
66
- Formanting now accepts any audio format, as long as it is supported by FFmpeg.
77

8+
# 7/25 Changelog:
9+
- 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.
810

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

run.sh

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

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

1218
requirements_file="requirements.txt"
1319

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+
1488
# Check if Python 3.8 is installed
1589
if ! command -v python3.8 &> /dev/null; then
1690
echo "Python 3.8 not found. Attempting to install..."
@@ -27,7 +101,7 @@ fi
27101

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

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+
44140
# Run the main script
45-
python3.8 infer-web.py --pycmd python3.8
141+
python3.8 infer-web.py --pycmd python3.8

0 commit comments

Comments
 (0)