Spaces:
Runtime error
Runtime error
Upload 14 files
Browse files- Dockerfile +19 -0
- LICENSE +26 -0
- Makefile +24 -0
- README.md +110 -12
- app.py +58 -0
- core.py +764 -0
- docker-compose.yaml +16 -0
- requirements.txt +35 -0
- run-applio.bat +12 -0
- run-applio.sh +6 -0
- run-install.bat +73 -0
- run-install.sh +87 -0
- run-tensorboard.bat +6 -0
- run-tensorboard.sh +6 -0
Dockerfile
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# syntax=docker/dockerfile:1
|
2 |
+
|
3 |
+
FROM python:3.10-bullseye
|
4 |
+
|
5 |
+
EXPOSE 6969
|
6 |
+
|
7 |
+
WORKDIR /app
|
8 |
+
|
9 |
+
RUN apt update && apt install -y -qq ffmpeg aria2 && apt clean
|
10 |
+
|
11 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
12 |
+
|
13 |
+
COPY . .
|
14 |
+
|
15 |
+
VOLUME [ "/app/logs/weights", "/app/opt" ]
|
16 |
+
|
17 |
+
ENTRYPOINT [ "python3" ]
|
18 |
+
|
19 |
+
CMD ["app.py"]
|
LICENSE
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License (Non-Commercial)
|
2 |
+
|
3 |
+
Copyright (c) 2023 AI Hispano
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to use,
|
7 |
+
copy, modify, merge, publish and/or distribute Applio-RVC-Fork, subject to the following conditions:
|
8 |
+
|
9 |
+
1. The software and its derivatives may only be used for non-commercial
|
10 |
+
purposes.
|
11 |
+
|
12 |
+
2. Any commercial use, sale, or distribution of the software or its derivatives
|
13 |
+
is strictly prohibited.
|
14 |
+
|
15 |
+
3. The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
24 |
+
SOFTWARE.
|
25 |
+
|
26 |
+
Please note that under this license, the software and its derivatives can only be used for non-commercial purposes, and any commercial use, sale, or distribution is prohibited.
|
Makefile
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.PHONY:
|
2 |
+
.ONESHELL:
|
3 |
+
|
4 |
+
# Show help message
|
5 |
+
help:
|
6 |
+
@grep -hE '^[A-Za-z0-9_ \-]*?:.*##.*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
7 |
+
|
8 |
+
# Install dependencies
|
9 |
+
run-install:
|
10 |
+
apt-get -y install build-essential python3-dev ffmpeg
|
11 |
+
pip install --upgrade setuptools wheel
|
12 |
+
pip install --upgrade pip
|
13 |
+
pip install faiss-gpu fairseq gradio ffmpeg ffmpeg-python praat-parselmouth pyworld numpy==1.23.5 numba==0.56.4 librosa==0.9.1
|
14 |
+
pip install -r requirements.txt
|
15 |
+
pip install --upgrade lxml
|
16 |
+
apt-get update
|
17 |
+
|
18 |
+
# Run Applio
|
19 |
+
run-applio:
|
20 |
+
python app.py
|
21 |
+
|
22 |
+
# Run Tensorboard
|
23 |
+
run-tensorboard:
|
24 |
+
python core.py tensorboard
|
README.md
CHANGED
@@ -1,12 +1,110 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Applio
|
2 |
+
Welcome to **Applio**, the ultimate voice cloning tool meticulously optimized for unrivaled power, modularity, and a user-friendly experience.
|
3 |
+
|
4 |
+
![GitHub Release](https://img.shields.io/github/v/release/iahispano/applio-rvc-fork?style=flat-square)
|
5 |
+
![GitHub Repo stars](https://img.shields.io/github/stars/iahispano/applio-rvc-fork?style=flat-square)
|
6 |
+
![GitHub forks](https://img.shields.io/github/forks/iahispano/applio-rvc-fork?style=flat-square)
|
7 |
+
[![Support Discord](https://img.shields.io/discord/1096877223765606521?style=flat-square)](https://discord.gg/iahispano)
|
8 |
+
[![Downloads](https://img.shields.io/github/downloads/iahispano/applio-rvc-fork/total?style=flat-square)](https://github.com/IAHispano/Applio-RVC-Fork/releases)
|
9 |
+
[![Issues](https://img.shields.io/github/issues/iahispano/applio-rvc-fork?style=flat-square)](https://github.com/IAHispano/Applio-RVC-Fork/issues)
|
10 |
+
<!-- WORKING ON THIS
|
11 |
+
[![Open In Collab](https://img.shields.io/badge/google_colab-F9AB00?style=flat-square&logo=googlecolab&logoColor=white)](https://colab.research.google.com/github/iahispano/applio/blob/master/assets/Applio.ipynb)
|
12 |
+
-->
|
13 |
+
|
14 |
+
## Content Table
|
15 |
+
- [**Installation**](#installation)
|
16 |
+
- [Windows](#windows)
|
17 |
+
- [Linux](#linux)
|
18 |
+
- [Using Makefile](#using-makefile-for-platforms-such-as-paperspace)
|
19 |
+
- [**Usage**](#usage)
|
20 |
+
- [Windows](#windows-1)
|
21 |
+
- [Linux](#linux-1)
|
22 |
+
- [Using Makefile](#using-makefile-for-platforms-such-as-paperspace-1)
|
23 |
+
- [**Repository Enhancements**](#repository-enhancements)
|
24 |
+
- [**Credits**](#credits)
|
25 |
+
- [Contributors](#contributors)
|
26 |
+
|
27 |
+
## Installation
|
28 |
+
Download the latest version from [GitHub Releases](https://github.com/IAHispano/Applio-RVC-Fork/releases).
|
29 |
+
|
30 |
+
### Windows
|
31 |
+
```bash
|
32 |
+
./run-install.bat
|
33 |
+
```
|
34 |
+
|
35 |
+
### Linux
|
36 |
+
```bash
|
37 |
+
chmod +x run-install.sh
|
38 |
+
./run-install.sh
|
39 |
+
```
|
40 |
+
|
41 |
+
### Using Makefile (for platforms such as [Paperspace](https://www.paperspace.com/))
|
42 |
+
```
|
43 |
+
make run-install
|
44 |
+
```
|
45 |
+
|
46 |
+
## Usage
|
47 |
+
Visit [Applio Documentation](https://docs.applio.org/) for a detailed UI usage explanation.
|
48 |
+
|
49 |
+
### Windows
|
50 |
+
```bash
|
51 |
+
./run-applio.bat
|
52 |
+
```
|
53 |
+
|
54 |
+
### Linux
|
55 |
+
```bash
|
56 |
+
chmod +x run-applio.sh
|
57 |
+
./run-applio.sh
|
58 |
+
```
|
59 |
+
|
60 |
+
### Using Makefile (for platforms such as [Paperspace](https://www.paperspace.com/))
|
61 |
+
```
|
62 |
+
make run-applio
|
63 |
+
```
|
64 |
+
|
65 |
+
## Repository Enhancements
|
66 |
+
|
67 |
+
This repository has undergone significant improvements to enhance its functionality and maintainability:
|
68 |
+
|
69 |
+
- **Code Modularization:** The codebase has been restructured to follow a modular approach. This ensures better organization, readability, and ease of maintenance.
|
70 |
+
- **Hop Length Implementation:** Special thanks to [@Mangio621](https://github.com/Mangio621/Mangio-RVC-Fork) for introducing hop length implementation. This enhancement enhances the efficiency and performance on Crepe (previously known as Mangio-Crepe).
|
71 |
+
- **Translations to +30 Languages:** The repository now supports translations in over 30 languages, making it more accessible to a global audience.
|
72 |
+
- **Cross-Platform Compatibility:** With multiplatform compatibility, this repository can seamlessly operate across various platforms, providing a consistent experience to users.
|
73 |
+
- **Optimized Requirements:** The project's requirements have been fine-tuned for improved performance and resource utilization.
|
74 |
+
- **Simple Installation:** The installation process has been streamlined, ensuring a straightforward and user-friendly experience for setup.
|
75 |
+
|
76 |
+
These enhancements contribute to a more robust and scalable codebase, making the repository more accessible for contributors and users alike.
|
77 |
+
|
78 |
+
## Contributions
|
79 |
+
- **Backend Contributions:** If you want to contribute to the backend, make your pull requests [here](https://github.com/blaise-tk/RVC_CLI).
|
80 |
+
- **Frontend Contributions:** For interface or script-related contributions, feel free to contribute to this repository.
|
81 |
+
|
82 |
+
We appreciate all contributions ❤️
|
83 |
+
|
84 |
+
## Planned Features
|
85 |
+
- Implement: Support for Apple Devices ([Issue Link](https://github.com/pytorch/pytorch/issues/77764))
|
86 |
+
- Implement: rmvpe_gpu
|
87 |
+
- Implement: Theme selector
|
88 |
+
- Fix: Save on every weight
|
89 |
+
- Fix: Model fusion
|
90 |
+
|
91 |
+
## Credits
|
92 |
+
- [VITS](https://github.com/jaywalnut310/vits) by jaywalnut310
|
93 |
+
- [Retrieval-based-Voice-Conversion-WebUI](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI) by RVC-Project
|
94 |
+
- [Mangio-RVC-Fork](https://github.com/Mangio621/Mangio-RVC-Fork) by Mangio621
|
95 |
+
- [Mangio-RVC-Tweaks](https://github.com/alexlnkp/Mangio-RVC-Tweaks) by alexlnkp
|
96 |
+
- [RVG_tts](https://github.com/Foxify52/RVG_tts) by Foxify52
|
97 |
+
- [RMVPE](https://github.com/Dream-High/RMVPE) by Dream-High
|
98 |
+
- [ContentVec](https://github.com/auspicious3000/contentvec/) by auspicious3000
|
99 |
+
- [HIFIGAN](https://github.com/jik876/hifi-gan) by jik876
|
100 |
+
- [Gradio](https://github.com/gradio-app/gradio) by gradio-app
|
101 |
+
- [FFmpeg](https://github.com/FFmpeg/FFmpeg) by FFmpeg
|
102 |
+
- [audio-slicer](https://github.com/openvpi/audio-slicer) by openvpi
|
103 |
+
- [Ilaria-Audio-Analyzer](https://github.com/TheStingerX/Ilaria-Audio-Analyzer) by TheStingerX
|
104 |
+
- [gradio-screen-recorder](https://huggingface.co/spaces/gstaff/gradio-screen-recorder) by gstaff
|
105 |
+
- [RVC_CLI](https://github.com/blaise-tk/RVC_CLI) by blaise-tk
|
106 |
+
|
107 |
+
### Contributors
|
108 |
+
<a href="https://github.com/IAHispano/Applio/graphs/contributors" target="_blank">
|
109 |
+
<img src="https://contrib.rocks/image?repo=IAHispano/Applio" />
|
110 |
+
</a>
|
app.py
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import sys
|
3 |
+
import os
|
4 |
+
|
5 |
+
now_dir = os.getcwd()
|
6 |
+
sys.path.append(now_dir)
|
7 |
+
|
8 |
+
from assets.i18n.i18n import I18nAuto
|
9 |
+
|
10 |
+
i18n = I18nAuto()
|
11 |
+
|
12 |
+
from tabs.inference.inference import inference_tab
|
13 |
+
from tabs.train.train import train_tab
|
14 |
+
from tabs.extra.extra import extra_tab
|
15 |
+
from tabs.report.report import report_tab
|
16 |
+
from tabs.download.download import download_tab
|
17 |
+
from tabs.tts.tts import tts_tab
|
18 |
+
from assets.discord_presence import rich_presence
|
19 |
+
|
20 |
+
rich_presence()
|
21 |
+
|
22 |
+
with gr.Blocks(theme="ParityError/Interstellar", title="Applio") as Applio:
|
23 |
+
gr.Markdown("# Applio")
|
24 |
+
gr.Markdown(
|
25 |
+
i18n(
|
26 |
+
"Ultimate voice cloning tool, meticulously optimized for unrivaled power, modularity, and user-friendly experience."
|
27 |
+
)
|
28 |
+
)
|
29 |
+
gr.Markdown(
|
30 |
+
i18n(
|
31 |
+
"[Support](https://discord.gg/IAHispano) — [Discord Bot](https://discord.com/oauth2/authorize?client_id=1144714449563955302&permissions=1376674695271&scope=bot%20applications.commands) — [Find Voices](https://applio.org/models) — [GitHub](https://github.com/IAHispano/Applio)"
|
32 |
+
)
|
33 |
+
)
|
34 |
+
with gr.Tab(i18n("Inference")):
|
35 |
+
inference_tab()
|
36 |
+
|
37 |
+
with gr.Tab(i18n("Train")):
|
38 |
+
train_tab()
|
39 |
+
|
40 |
+
with gr.Tab(i18n("TTS")):
|
41 |
+
tts_tab()
|
42 |
+
|
43 |
+
with gr.Tab(i18n("Extra")):
|
44 |
+
extra_tab()
|
45 |
+
|
46 |
+
with gr.Tab(i18n("Download")):
|
47 |
+
download_tab()
|
48 |
+
|
49 |
+
with gr.Tab(i18n("Report a Bug")):
|
50 |
+
report_tab()
|
51 |
+
|
52 |
+
if __name__ == "__main__":
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
import argparse
|
4 |
+
import subprocess
|
5 |
+
|
6 |
+
now_dir = os.getcwd()
|
7 |
+
sys.path.append(now_dir)
|
8 |
+
|
9 |
+
from rvc.configs.config import Config
|
10 |
+
from rvc.lib.tools.validators import (
|
11 |
+
validate_sampling_rate,
|
12 |
+
validate_f0up_key,
|
13 |
+
validate_f0method,
|
14 |
+
validate_true_false,
|
15 |
+
validate_tts_voices,
|
16 |
+
)
|
17 |
+
|
18 |
+
from rvc.train.extract.preparing_files import generate_config, generate_filelist
|
19 |
+
from rvc.lib.tools.pretrained_selector import pretrained_selector
|
20 |
+
|
21 |
+
from rvc.lib.process.model_fusion import model_fusion
|
22 |
+
from rvc.lib.process.model_information import model_information
|
23 |
+
|
24 |
+
config = Config()
|
25 |
+
current_script_directory = os.path.dirname(os.path.realpath(__file__))
|
26 |
+
logs_path = os.path.join(current_script_directory, "logs")
|
27 |
+
subprocess.run(
|
28 |
+
["python", os.path.join("rvc", "lib", "tools", "prerequisites_download.py")]
|
29 |
+
)
|
30 |
+
|
31 |
+
|
32 |
+
# Infer
|
33 |
+
def run_infer_script(
|
34 |
+
f0up_key,
|
35 |
+
filter_radius,
|
36 |
+
index_rate,
|
37 |
+
hop_length,
|
38 |
+
f0method,
|
39 |
+
input_path,
|
40 |
+
output_path,
|
41 |
+
pth_file,
|
42 |
+
index_path,
|
43 |
+
split_audio,
|
44 |
+
):
|
45 |
+
infer_script_path = os.path.join("rvc", "infer", "infer.py")
|
46 |
+
command = [
|
47 |
+
"python",
|
48 |
+
infer_script_path,
|
49 |
+
str(f0up_key),
|
50 |
+
str(filter_radius),
|
51 |
+
str(index_rate),
|
52 |
+
str(hop_length),
|
53 |
+
f0method,
|
54 |
+
input_path,
|
55 |
+
output_path,
|
56 |
+
pth_file,
|
57 |
+
index_path,
|
58 |
+
str(split_audio),
|
59 |
+
]
|
60 |
+
subprocess.run(command)
|
61 |
+
return f"File {input_path} inferred successfully.", output_path
|
62 |
+
|
63 |
+
|
64 |
+
# Batch infer
|
65 |
+
def run_batch_infer_script(
|
66 |
+
f0up_key,
|
67 |
+
filter_radius,
|
68 |
+
index_rate,
|
69 |
+
hop_length,
|
70 |
+
f0method,
|
71 |
+
input_folder,
|
72 |
+
output_folder,
|
73 |
+
pth_file,
|
74 |
+
index_path,
|
75 |
+
):
|
76 |
+
infer_script_path = os.path.join("rvc", "infer", "infer.py")
|
77 |
+
|
78 |
+
audio_files = [
|
79 |
+
f for f in os.listdir(input_folder) if f.endswith((".mp3", ".wav", ".flac"))
|
80 |
+
]
|
81 |
+
print(f"Detected {len(audio_files)} audio files for inference.")
|
82 |
+
|
83 |
+
for audio_file in audio_files:
|
84 |
+
if "_output" in audio_file:
|
85 |
+
pass
|
86 |
+
else:
|
87 |
+
input_path = os.path.join(input_folder, audio_file)
|
88 |
+
output_file_name = os.path.splitext(os.path.basename(audio_file))[0]
|
89 |
+
output_path = os.path.join(
|
90 |
+
output_folder,
|
91 |
+
f"{output_file_name}_output{os.path.splitext(audio_file)[1]}",
|
92 |
+
)
|
93 |
+
print(f"Inferring {input_path}...")
|
94 |
+
|
95 |
+
command = [
|
96 |
+
"python",
|
97 |
+
infer_script_path,
|
98 |
+
str(f0up_key),
|
99 |
+
str(filter_radius),
|
100 |
+
str(index_rate),
|
101 |
+
str(hop_length),
|
102 |
+
f0method,
|
103 |
+
input_path,
|
104 |
+
output_path,
|
105 |
+
pth_file,
|
106 |
+
index_path,
|
107 |
+
]
|
108 |
+
subprocess.run(command)
|
109 |
+
|
110 |
+
return f"Files from {input_folder} inferred successfully."
|
111 |
+
|
112 |
+
|
113 |
+
# TTS
|
114 |
+
def run_tts_script(
|
115 |
+
tts_text,
|
116 |
+
tts_voice,
|
117 |
+
f0up_key,
|
118 |
+
filter_radius,
|
119 |
+
index_rate,
|
120 |
+
hop_length,
|
121 |
+
f0method,
|
122 |
+
output_tts_path,
|
123 |
+
output_rvc_path,
|
124 |
+
pth_file,
|
125 |
+
index_path,
|
126 |
+
):
|
127 |
+
tts_script_path = os.path.join("rvc", "lib", "tools", "tts.py")
|
128 |
+
infer_script_path = os.path.join("rvc", "infer", "infer.py")
|
129 |
+
|
130 |
+
if os.path.exists(output_tts_path):
|
131 |
+
os.remove(output_tts_path)
|
132 |
+
|
133 |
+
command_tts = [
|
134 |
+
"python",
|
135 |
+
tts_script_path,
|
136 |
+
tts_text,
|
137 |
+
tts_voice,
|
138 |
+
output_tts_path,
|
139 |
+
]
|
140 |
+
|
141 |
+
command_infer = [
|
142 |
+
"python",
|
143 |
+
infer_script_path,
|
144 |
+
str(f0up_key),
|
145 |
+
str(filter_radius),
|
146 |
+
str(index_rate),
|
147 |
+
str(hop_length),
|
148 |
+
f0method,
|
149 |
+
output_tts_path,
|
150 |
+
output_rvc_path,
|
151 |
+
pth_file,
|
152 |
+
index_path,
|
153 |
+
]
|
154 |
+
subprocess.run(command_tts)
|
155 |
+
subprocess.run(command_infer)
|
156 |
+
return f"Text {tts_text} synthesized successfully.", output_rvc_path
|
157 |
+
|
158 |
+
|
159 |
+
# Preprocess
|
160 |
+
def run_preprocess_script(model_name, dataset_path, sampling_rate):
|
161 |
+
per = 3.0 if config.is_half else 3.7
|
162 |
+
preprocess_script_path = os.path.join("rvc", "train", "preprocess", "preprocess.py")
|
163 |
+
command = [
|
164 |
+
"python",
|
165 |
+
preprocess_script_path,
|
166 |
+
os.path.join(logs_path, str(model_name)),
|
167 |
+
dataset_path,
|
168 |
+
str(sampling_rate),
|
169 |
+
str(per),
|
170 |
+
]
|
171 |
+
|
172 |
+
os.mkdir(os.path.join(logs_path, str(model_name)))
|
173 |
+
subprocess.run(command)
|
174 |
+
return f"Model {model_name} preprocessed successfully."
|
175 |
+
|
176 |
+
|
177 |
+
# Extract
|
178 |
+
def run_extract_script(model_name, rvc_version, f0method, hop_length, sampling_rate):
|
179 |
+
model_path = os.path.join(logs_path, str(model_name))
|
180 |
+
extract_f0_script_path = os.path.join(
|
181 |
+
"rvc", "train", "extract", "extract_f0_print.py"
|
182 |
+
)
|
183 |
+
extract_feature_script_path = os.path.join(
|
184 |
+
"rvc", "train", "extract", "extract_feature_print.py"
|
185 |
+
)
|
186 |
+
|
187 |
+
command_1 = [
|
188 |
+
"python",
|
189 |
+
extract_f0_script_path,
|
190 |
+
model_path,
|
191 |
+
f0method,
|
192 |
+
str(hop_length),
|
193 |
+
]
|
194 |
+
command_2 = [
|
195 |
+
"python",
|
196 |
+
extract_feature_script_path,
|
197 |
+
config.device,
|
198 |
+
"1",
|
199 |
+
"0",
|
200 |
+
"0",
|
201 |
+
model_path,
|
202 |
+
rvc_version,
|
203 |
+
"True",
|
204 |
+
]
|
205 |
+
subprocess.run(command_1)
|
206 |
+
subprocess.run(command_2)
|
207 |
+
|
208 |
+
generate_config(rvc_version, sampling_rate, model_path)
|
209 |
+
generate_filelist(f0method, model_path, rvc_version, sampling_rate)
|
210 |
+
return f"Model {model_name} extracted successfully."
|
211 |
+
|
212 |
+
|
213 |
+
# Train
|
214 |
+
def run_train_script(
|
215 |
+
model_name,
|
216 |
+
rvc_version,
|
217 |
+
save_every_epoch,
|
218 |
+
save_only_latest,
|
219 |
+
save_every_weights,
|
220 |
+
total_epoch,
|
221 |
+
sampling_rate,
|
222 |
+
batch_size,
|
223 |
+
gpu,
|
224 |
+
pitch_guidance,
|
225 |
+
pretrained,
|
226 |
+
custom_pretrained,
|
227 |
+
g_pretrained_path=None,
|
228 |
+
d_pretrained_path=None,
|
229 |
+
):
|
230 |
+
f0 = 1 if pitch_guidance == "True" else 0
|
231 |
+
latest = 1 if save_only_latest == "True" else 0
|
232 |
+
save_every = 1 if save_every_weights == "True" else 0
|
233 |
+
|
234 |
+
if pretrained == "True":
|
235 |
+
if custom_pretrained == "False":
|
236 |
+
pg, pd = pretrained_selector(f0)[rvc_version][sampling_rate]
|
237 |
+
else:
|
238 |
+
if g_pretrained_path is None or d_pretrained_path is None:
|
239 |
+
raise ValueError(
|
240 |
+
"Please provide the path to the pretrained G and D models."
|
241 |
+
)
|
242 |
+
pg, pd = g_pretrained_path, d_pretrained_path
|
243 |
+
else:
|
244 |
+
pg, pd = "", ""
|
245 |
+
|
246 |
+
train_script_path = os.path.join("rvc", "train", "train.py")
|
247 |
+
command = [
|
248 |
+
"python",
|
249 |
+
train_script_path,
|
250 |
+
"-se",
|
251 |
+
str(save_every_epoch),
|
252 |
+
"-te",
|
253 |
+
str(total_epoch),
|
254 |
+
"-pg",
|
255 |
+
pg,
|
256 |
+
"-pd",
|
257 |
+
pd,
|
258 |
+
"-sr",
|
259 |
+
str(sampling_rate),
|
260 |
+
"-bs",
|
261 |
+
str(batch_size),
|
262 |
+
"-g",
|
263 |
+
gpu,
|
264 |
+
"-e",
|
265 |
+
os.path.join(logs_path, str(model_name)),
|
266 |
+
"-v",
|
267 |
+
rvc_version,
|
268 |
+
"-l",
|
269 |
+
str(latest),
|
270 |
+
"-c",
|
271 |
+
"0",
|
272 |
+
"-sw",
|
273 |
+
str(save_every),
|
274 |
+
"-f0",
|
275 |
+
str(f0),
|
276 |
+
]
|
277 |
+
|
278 |
+
subprocess.run(command)
|
279 |
+
run_index_script(model_name, rvc_version)
|
280 |
+
return f"Model {model_name} trained successfully."
|
281 |
+
|
282 |
+
|
283 |
+
# Index
|
284 |
+
def run_index_script(model_name, rvc_version):
|
285 |
+
index_script_path = os.path.join("rvc", "train", "index_generator.py")
|
286 |
+
command = [
|
287 |
+
"python",
|
288 |
+
index_script_path,
|
289 |
+
os.path.join(logs_path, str(model_name)),
|
290 |
+
rvc_version,
|
291 |
+
]
|
292 |
+
|
293 |
+
subprocess.run(command)
|
294 |
+
return f"Index file for {model_name} generated successfully."
|
295 |
+
|
296 |
+
|
297 |
+
# Model information
|
298 |
+
def run_model_information_script(pth_path):
|
299 |
+
print(model_information(pth_path))
|
300 |
+
|
301 |
+
|
302 |
+
# Model fusion
|
303 |
+
def run_model_fusion_script(model_name, pth_path_1, pth_path_2):
|
304 |
+
model_fusion(model_name, pth_path_1, pth_path_2)
|
305 |
+
|
306 |
+
|
307 |
+
# Tensorboard
|
308 |
+
def run_tensorboard_script():
|
309 |
+
tensorboard_script_path = os.path.join(
|
310 |
+
"rvc", "lib", "tools", "launch_tensorboard.py"
|
311 |
+
)
|
312 |
+
command = [
|
313 |
+
"python",
|
314 |
+
tensorboard_script_path,
|
315 |
+
]
|
316 |
+
subprocess.run(command)
|
317 |
+
|
318 |
+
|
319 |
+
# Download
|
320 |
+
def run_download_script(model_link):
|
321 |
+
download_script_path = os.path.join("rvc", "lib", "tools", "model_download.py")
|
322 |
+
command = [
|
323 |
+
"python",
|
324 |
+
download_script_path,
|
325 |
+
model_link,
|
326 |
+
]
|
327 |
+
subprocess.run(command)
|
328 |
+
return f"Model downloaded successfully."
|
329 |
+
|
330 |
+
|
331 |
+
# Parse arguments
|
332 |
+
def parse_arguments():
|
333 |
+
parser = argparse.ArgumentParser(
|
334 |
+
description="Run the main.py script with specific parameters."
|
335 |
+
)
|
336 |
+
subparsers = parser.add_subparsers(
|
337 |
+
title="subcommands", dest="mode", help="Choose a mode"
|
338 |
+
)
|
339 |
+
|
340 |
+
# Parser for 'infer' mode
|
341 |
+
infer_parser = subparsers.add_parser("infer", help="Run inference")
|
342 |
+
infer_parser.add_argument(
|
343 |
+
"f0up_key",
|
344 |
+
type=validate_f0up_key,
|
345 |
+
help="Value for f0up_key (-12 to +12)",
|
346 |
+
)
|
347 |
+
infer_parser.add_argument(
|
348 |
+
"filter_radius",
|
349 |
+
type=str,
|
350 |
+
help="Value for filter_radius (0 to 10)",
|
351 |
+
)
|
352 |
+
infer_parser.add_argument(
|
353 |
+
"index_rate",
|
354 |
+
type=str,
|
355 |
+
help="Value for index_rate (0.0 to 1)",
|
356 |
+
)
|
357 |
+
infer_parser.add_argument(
|
358 |
+
"hop_length",
|
359 |
+
type=str,
|
360 |
+
help="Value for hop_length (1 to 512)",
|
361 |
+
)
|
362 |
+
infer_parser.add_argument(
|
363 |
+
"f0method",
|
364 |
+
type=validate_f0method,
|
365 |
+
help="Value for f0method (pm, dio, crepe, crepe-tiny, harvest, rmvpe)",
|
366 |
+
)
|
367 |
+
infer_parser.add_argument(
|
368 |
+
"input_path", type=str, help="Input path (enclose in double quotes)"
|
369 |
+
)
|
370 |
+
infer_parser.add_argument(
|
371 |
+
"output_path", type=str, help="Output path (enclose in double quotes)"
|
372 |
+
)
|
373 |
+
infer_parser.add_argument(
|
374 |
+
"pth_file", type=str, help="Path to the .pth file (enclose in double quotes)"
|
375 |
+
)
|
376 |
+
infer_parser.add_argument(
|
377 |
+
"index_path",
|
378 |
+
type=str,
|
379 |
+
help="Path to the .index file (enclose in double quotes)",
|
380 |
+
)
|
381 |
+
infer_parser.add_argument(
|
382 |
+
"split_audio",
|
383 |
+
type=str,
|
384 |
+
help="Enable split audio ( better results )",
|
385 |
+
)
|
386 |
+
|
387 |
+
# Parser for 'batch_infer' mode
|
388 |
+
batch_infer_parser = subparsers.add_parser(
|
389 |
+
"batch_infer", help="Run batch inference"
|
390 |
+
)
|
391 |
+
batch_infer_parser.add_argument(
|
392 |
+
"f0up_key",
|
393 |
+
type=validate_f0up_key,
|
394 |
+
help="Value for f0up_key (-12 to +12)",
|
395 |
+
)
|
396 |
+
batch_infer_parser.add_argument(
|
397 |
+
"filter_radius",
|
398 |
+
type=str,
|
399 |
+
help="Value for filter_radius (0 to 10)",
|
400 |
+
)
|
401 |
+
batch_infer_parser.add_argument(
|
402 |
+
"index_rate",
|
403 |
+
type=str,
|
404 |
+
help="Value for index_rate (0.0 to 1)",
|
405 |
+
)
|
406 |
+
batch_infer_parser.add_argument(
|
407 |
+
"hop_length",
|
408 |
+
type=str,
|
409 |
+
help="Value for hop_length (1 to 512)",
|
410 |
+
)
|
411 |
+
batch_infer_parser.add_argument(
|
412 |
+
"f0method",
|
413 |
+
type=validate_f0method,
|
414 |
+
help="Value for f0method (pm, dio, crepe, crepe-tiny, harvest, rmvpe)",
|
415 |
+
)
|
416 |
+
batch_infer_parser.add_argument(
|
417 |
+
"input_folder", type=str, help="Input folder (enclose in double quotes)"
|
418 |
+
)
|
419 |
+
batch_infer_parser.add_argument(
|
420 |
+
"output_folder", type=str, help="Output folder (enclose in double quotes)"
|
421 |
+
)
|
422 |
+
batch_infer_parser.add_argument(
|
423 |
+
"pth_file", type=str, help="Path to the .pth file (enclose in double quotes)"
|
424 |
+
)
|
425 |
+
batch_infer_parser.add_argument(
|
426 |
+
"index_path",
|
427 |
+
type=str,
|
428 |
+
help="Path to the .index file (enclose in double quotes)",
|
429 |
+
)
|
430 |
+
|
431 |
+
# Parser for 'tts' mode
|
432 |
+
tts_parser = subparsers.add_parser("tts", help="Run TTS")
|
433 |
+
tts_parser.add_argument(
|
434 |
+
"tts_text",
|
435 |
+
type=str,
|
436 |
+
help="Text to be synthesized (enclose in double quotes)",
|
437 |
+
)
|
438 |
+
tts_parser.add_argument(
|
439 |
+
"tts_voice",
|
440 |
+
type=validate_tts_voices,
|
441 |
+
help="Voice to be used (enclose in double quotes)",
|
442 |
+
)
|
443 |
+
tts_parser.add_argument(
|
444 |
+
"f0up_key",
|
445 |
+
type=validate_f0up_key,
|
446 |
+
help="Value for f0up_key (-12 to +12)",
|
447 |
+
)
|
448 |
+
tts_parser.add_argument(
|
449 |
+
"filter_radius",
|
450 |
+
type=str,
|
451 |
+
help="Value for filter_radius (0 to 10)",
|
452 |
+
)
|
453 |
+
tts_parser.add_argument(
|
454 |
+
"index_rate",
|
455 |
+
type=str,
|
456 |
+
help="Value for index_rate (0.0 to 1)",
|
457 |
+
)
|
458 |
+
tts_parser.add_argument(
|
459 |
+
"hop_length",
|
460 |
+
type=str,
|
461 |
+
help="Value for hop_length (1 to 512)",
|
462 |
+
)
|
463 |
+
tts_parser.add_argument(
|
464 |
+
"f0method",
|
465 |
+
type=validate_f0method,
|
466 |
+
help="Value for f0method (pm, dio, crepe, crepe-tiny, harvest, rmvpe)",
|
467 |
+
)
|
468 |
+
tts_parser.add_argument(
|
469 |
+
"output_tts_path", type=str, help="Output tts path (enclose in double quotes)"
|
470 |
+
)
|
471 |
+
tts_parser.add_argument(
|
472 |
+
"output_rvc_path", type=str, help="Output rvc path (enclose in double quotes)"
|
473 |
+
)
|
474 |
+
tts_parser.add_argument(
|
475 |
+
"pth_file", type=str, help="Path to the .pth file (enclose in double quotes)"
|
476 |
+
)
|
477 |
+
tts_parser.add_argument(
|
478 |
+
"index_path",
|
479 |
+
type=str,
|
480 |
+
help="Path to the .index file (enclose in double quotes)",
|
481 |
+
)
|
482 |
+
|
483 |
+
# Parser for 'preprocess' mode
|
484 |
+
preprocess_parser = subparsers.add_parser("preprocess", help="Run preprocessing")
|
485 |
+
preprocess_parser.add_argument(
|
486 |
+
"model_name", type=str, help="Name of the model (enclose in double quotes)"
|
487 |
+
)
|
488 |
+
preprocess_parser.add_argument(
|
489 |
+
"dataset_path",
|
490 |
+
type=str,
|
491 |
+
help="Path to the dataset (enclose in double quotes)",
|
492 |
+
)
|
493 |
+
preprocess_parser.add_argument(
|
494 |
+
"sampling_rate",
|
495 |
+
type=validate_sampling_rate,
|
496 |
+
help="Sampling rate (32000, 40000 or 48000)",
|
497 |
+
)
|
498 |
+
|
499 |
+
# Parser for 'extract' mode
|
500 |
+
extract_parser = subparsers.add_parser("extract", help="Run extract")
|
501 |
+
extract_parser.add_argument(
|
502 |
+
"model_name",
|
503 |
+
type=str,
|
504 |
+
help="Name of the model (enclose in double quotes)",
|
505 |
+
)
|
506 |
+
extract_parser.add_argument(
|
507 |
+
"rvc_version",
|
508 |
+
type=str,
|
509 |
+
help="Version of the model (v1 or v2)",
|
510 |
+
)
|
511 |
+
extract_parser.add_argument(
|
512 |
+
"f0method",
|
513 |
+
type=validate_f0method,
|
514 |
+
help="Value for f0method (pm, dio, crepe, crepe-tiny, mangio-crepe, mangio-crepe-tiny, harvest, rmvpe)",
|
515 |
+
)
|
516 |
+
extract_parser.add_argument(
|
517 |
+
"hop_length",
|
518 |
+
type=str,
|
519 |
+
help="Value for hop_length (1 to 512)",
|
520 |
+
)
|
521 |
+
extract_parser.add_argument(
|
522 |
+
"sampling_rate",
|
523 |
+
type=validate_sampling_rate,
|
524 |
+
help="Sampling rate (32000, 40000 or 48000)",
|
525 |
+
)
|
526 |
+
|
527 |
+
# Parser for 'train' mode
|
528 |
+
train_parser = subparsers.add_parser("train", help="Run training")
|
529 |
+
train_parser.add_argument(
|
530 |
+
"model_name",
|
531 |
+
type=str,
|
532 |
+
help="Name of the model (enclose in double quotes)",
|
533 |
+
)
|
534 |
+
train_parser.add_argument(
|
535 |
+
"rvc_version",
|
536 |
+
type=str,
|
537 |
+
help="Version of the model (v1 or v2)",
|
538 |
+
)
|
539 |
+
train_parser.add_argument(
|
540 |
+
"save_only_latest",
|
541 |
+
type=str,
|
542 |
+
help="Save weight only at last epoch",
|
543 |
+
)
|
544 |
+
train_parser.add_argument(
|
545 |
+
"save_every_weights",
|
546 |
+
type=str,
|
547 |
+
help="Save weight every epoch",
|
548 |
+
)
|
549 |
+
train_parser.add_argument(
|
550 |
+
"save_every_epoch",
|
551 |
+
type=str,
|
552 |
+
help="Save every epoch",
|
553 |
+
)
|
554 |
+
train_parser.add_argument(
|
555 |
+
"total_epoch",
|
556 |
+
type=str,
|
557 |
+
help="Total epoch",
|
558 |
+
)
|
559 |
+
train_parser.add_argument(
|
560 |
+
"sampling_rate",
|
561 |
+
type=validate_sampling_rate,
|
562 |
+
help="Sampling rate (32000, 40000, or 48000)",
|
563 |
+
)
|
564 |
+
train_parser.add_argument(
|
565 |
+
"batch_size",
|
566 |
+
type=str,
|
567 |
+
help="Batch size",
|
568 |
+
)
|
569 |
+
train_parser.add_argument(
|
570 |
+
"gpu",
|
571 |
+
type=str,
|
572 |
+
help="GPU number (0 to 10 separated by -)",
|
573 |
+
)
|
574 |
+
train_parser.add_argument(
|
575 |
+
"pitch_guidance",
|
576 |
+
type=validate_true_false,
|
577 |
+
help="Pitch guidance (True or False)",
|
578 |
+
)
|
579 |
+
train_parser.add_argument(
|
580 |
+
"pretrained",
|
581 |
+
type=validate_true_false,
|
582 |
+
help="Pretrained (True or False)",
|
583 |
+
)
|
584 |
+
train_parser.add_argument(
|
585 |
+
"custom_pretrained",
|
586 |
+
type=validate_true_false,
|
587 |
+
help="Custom pretrained (True or False)",
|
588 |
+
)
|
589 |
+
train_parser.add_argument(
|
590 |
+
"g_pretrained_path",
|
591 |
+
type=str,
|
592 |
+
nargs="?",
|
593 |
+
default=None,
|
594 |
+
help="Path to the pretrained G file (enclose in double quotes)",
|
595 |
+
)
|
596 |
+
train_parser.add_argument(
|
597 |
+
"d_pretrained_path",
|
598 |
+
type=str,
|
599 |
+
nargs="?",
|
600 |
+
default=None,
|
601 |
+
help="Path to the pretrained D file (enclose in double quotes)",
|
602 |
+
)
|
603 |
+
|
604 |
+
# Parser for 'index' mode
|
605 |
+
index_parser = subparsers.add_parser("index", help="Generate index file")
|
606 |
+
index_parser.add_argument(
|
607 |
+
"model_name",
|
608 |
+
type=str,
|
609 |
+
help="Name of the model (enclose in double quotes)",
|
610 |
+
)
|
611 |
+
index_parser.add_argument(
|
612 |
+
"rvc_version",
|
613 |
+
type=str,
|
614 |
+
help="Version of the model (v1 or v2)",
|
615 |
+
)
|
616 |
+
|
617 |
+
# Parser for 'model_information' mode
|
618 |
+
model_information_parser = subparsers.add_parser(
|
619 |
+
"model_information", help="Print model information"
|
620 |
+
)
|
621 |
+
model_information_parser.add_argument(
|
622 |
+
"pth_path",
|
623 |
+
type=str,
|
624 |
+
help="Path to the .pth file (enclose in double quotes)",
|
625 |
+
)
|
626 |
+
|
627 |
+
# Parser for 'model_fusion' mode
|
628 |
+
model_fusion_parser = subparsers.add_parser("model_fusion", help="Fuse two models")
|
629 |
+
model_fusion_parser.add_argument(
|
630 |
+
"model_name",
|
631 |
+
type=str,
|
632 |
+
help="Name of the model (enclose in double quotes)",
|
633 |
+
)
|
634 |
+
model_fusion_parser.add_argument(
|
635 |
+
"pth_path_1",
|
636 |
+
type=str,
|
637 |
+
help="Path to the first .pth file (enclose in double quotes)",
|
638 |
+
)
|
639 |
+
model_fusion_parser.add_argument(
|
640 |
+
"pth_path_2",
|
641 |
+
type=str,
|
642 |
+
help="Path to the second .pth file (enclose in double quotes)",
|
643 |
+
)
|
644 |
+
|
645 |
+
# Parser for 'tensorboard' mode
|
646 |
+
subparsers.add_parser("tensorboard", help="Run tensorboard")
|
647 |
+
|
648 |
+
# Parser for 'download' mode
|
649 |
+
download_parser = subparsers.add_parser("download", help="Download models")
|
650 |
+
download_parser.add_argument(
|
651 |
+
"model_link",
|
652 |
+
type=str,
|
653 |
+
help="Link of the model (enclose in double quotes)",
|
654 |
+
)
|
655 |
+
|
656 |
+
return parser.parse_args()
|
657 |
+
|
658 |
+
|
659 |
+
def main():
|
660 |
+
if len(sys.argv) == 1:
|
661 |
+
print("Please run the script with '-h' for more information.")
|
662 |
+
sys.exit(1)
|
663 |
+
|
664 |
+
args = parse_arguments()
|
665 |
+
|
666 |
+
try:
|
667 |
+
if args.mode == "infer":
|
668 |
+
run_infer_script(
|
669 |
+
args.f0up_key,
|
670 |
+
args.filter_radius,
|
671 |
+
args.index_rate,
|
672 |
+
args.hop_length,
|
673 |
+
args.f0method,
|
674 |
+
args.input_path,
|
675 |
+
args.output_path,
|
676 |
+
args.pth_file,
|
677 |
+
args.index_path,
|
678 |
+
args.split_audio,
|
679 |
+
)
|
680 |
+
elif args.mode == "batch_infer":
|
681 |
+
run_batch_infer_script(
|
682 |
+
args.f0up_key,
|
683 |
+
args.filter_radius,
|
684 |
+
args.index_rate,
|
685 |
+
args.hop_length,
|
686 |
+
args.f0method,
|
687 |
+
args.input_folder,
|
688 |
+
args.output_folder,
|
689 |
+
args.pth_file,
|
690 |
+
args.index_path,
|
691 |
+
)
|
692 |
+
elif args.mode == "tts":
|
693 |
+
run_tts_script(
|
694 |
+
args.tts_text,
|
695 |
+
args.tts_voice,
|
696 |
+
args.f0up_key,
|
697 |
+
args.filter_radius,
|
698 |
+
args.index_rate,
|
699 |
+
args.hop_length,
|
700 |
+
args.f0method,
|
701 |
+
args.output_tts_path,
|
702 |
+
args.output_rvc_path,
|
703 |
+
args.pth_file,
|
704 |
+
args.index_path,
|
705 |
+
)
|
706 |
+
elif args.mode == "preprocess":
|
707 |
+
run_preprocess_script(
|
708 |
+
args.model_name,
|
709 |
+
args.dataset_path,
|
710 |
+
str(args.sampling_rate),
|
711 |
+
)
|
712 |
+
|
713 |
+
elif args.mode == "extract":
|
714 |
+
run_extract_script(
|
715 |
+
args.model_name,
|
716 |
+
args.rvc_version,
|
717 |
+
args.f0method,
|
718 |
+
args.hop_length,
|
719 |
+
args.sampling_rate,
|
720 |
+
)
|
721 |
+
elif args.mode == "train":
|
722 |
+
run_train_script(
|
723 |
+
args.model_name,
|
724 |
+
args.rvc_version,
|
725 |
+
args.save_every_epoch,
|
726 |
+
args.save_only_latest,
|
727 |
+
args.save_every_weights,
|
728 |
+
args.total_epoch,
|
729 |
+
args.sampling_rate,
|
730 |
+
args.batch_size,
|
731 |
+
args.gpu,
|
732 |
+
args.pitch_guidance,
|
733 |
+
args.pretrained,
|
734 |
+
args.custom_pretrained,
|
735 |
+
args.g_pretrained_path,
|
736 |
+
args.d_pretrained_path,
|
737 |
+
)
|
738 |
+
elif args.mode == "index":
|
739 |
+
run_index_script(
|
740 |
+
args.model_name,
|
741 |
+
args.rvc_version,
|
742 |
+
)
|
743 |
+
elif args.mode == "model_information":
|
744 |
+
run_model_information_script(
|
745 |
+
args.pth_path,
|
746 |
+
)
|
747 |
+
elif args.mode == "model_fusion":
|
748 |
+
run_model_fusion_script(
|
749 |
+
args.model_name,
|
750 |
+
args.pth_path_1,
|
751 |
+
args.pth_path_2,
|
752 |
+
)
|
753 |
+
elif args.mode == "tensorboard":
|
754 |
+
run_tensorboard_script()
|
755 |
+
elif args.mode == "download":
|
756 |
+
run_download_script(
|
757 |
+
args.model_link,
|
758 |
+
)
|
759 |
+
except Exception as error:
|
760 |
+
print(f"Error: {error}")
|
761 |
+
|
762 |
+
|
763 |
+
if __name__ == "__main__":
|
764 |
+
main()
|
docker-compose.yaml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: '1'
|
2 |
+
|
3 |
+
services:
|
4 |
+
applio:
|
5 |
+
build:
|
6 |
+
context: ./
|
7 |
+
dockerfile: Dockerfile
|
8 |
+
ports:
|
9 |
+
- "6969"
|
10 |
+
deploy:
|
11 |
+
resources:
|
12 |
+
reservations:
|
13 |
+
devices:
|
14 |
+
- driver: nvidia
|
15 |
+
count: 1
|
16 |
+
capabilities: [gpu]
|
requirements.txt
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# General dependencies
|
2 |
+
ffmpeg-python>=0.2.0
|
3 |
+
numpy==1.23.5
|
4 |
+
requests
|
5 |
+
tqdm
|
6 |
+
wget
|
7 |
+
|
8 |
+
# Audio processing
|
9 |
+
faiss-cpu==1.7.3
|
10 |
+
librosa==0.9.1
|
11 |
+
pyworld==0.3.4
|
12 |
+
scipy==1.11.1
|
13 |
+
soundfile==0.12.1
|
14 |
+
praat-parselmouth
|
15 |
+
|
16 |
+
# Machine learning
|
17 |
+
fairseq==0.12.2
|
18 |
+
numba; sys_platform == 'linux'
|
19 |
+
numba==0.56.4; sys_platform == 'win32'
|
20 |
+
torch==2.1.1
|
21 |
+
torchcrepe==0.0.21
|
22 |
+
torchvision==0.16.1
|
23 |
+
|
24 |
+
# Visualization
|
25 |
+
matplotlib==3.7.2
|
26 |
+
tensorboard
|
27 |
+
gradio==4.14.0
|
28 |
+
|
29 |
+
# Miscellaneous
|
30 |
+
ffmpy==0.3.1
|
31 |
+
git+https://github.com/lanpa/tensorboardX
|
32 |
+
requests==2.31.0
|
33 |
+
edge-tts==6.1.9
|
34 |
+
pypresence
|
35 |
+
beautifulsoup4
|
run-applio.bat
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@echo off
|
2 |
+
setlocal
|
3 |
+
title Applio
|
4 |
+
|
5 |
+
if not exist env (
|
6 |
+
echo Please run 'run-install.bat' first to set up the environment.
|
7 |
+
pause
|
8 |
+
exit /b 1
|
9 |
+
)
|
10 |
+
|
11 |
+
env\python.exe app.py --open
|
12 |
+
pause
|
run-applio.sh
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
printf "\033]0;Applio\007"
|
3 |
+
. .venv/bin/activate
|
4 |
+
|
5 |
+
clear
|
6 |
+
python app.py --open
|
run-install.bat
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@echo off
|
2 |
+
setlocal
|
3 |
+
title Installer
|
4 |
+
|
5 |
+
set "principal=%cd%"
|
6 |
+
set "URL_EXTRA=https://huggingface.co/IAHispano/applio/resolve/main"
|
7 |
+
set "CONDA_ROOT_PREFIX=%UserProfile%\Miniconda3"
|
8 |
+
set "INSTALL_ENV_DIR=%principal%\env"
|
9 |
+
set "MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-py39_23.9.0-0-Windows-x86_64.exe"
|
10 |
+
set "CONDA_EXECUTABLE=%CONDA_ROOT_PREFIX%\Scripts\conda.exe"
|
11 |
+
|
12 |
+
del Makefile
|
13 |
+
del Dockerfile
|
14 |
+
del docker-compose.yaml
|
15 |
+
del /q *.sh
|
16 |
+
|
17 |
+
if not exist "%cd%\env.zip" (
|
18 |
+
echo Downloading the fairseq build...
|
19 |
+
curl -s -LJO %URL_EXTRA%/env.zip -o env.zip
|
20 |
+
)
|
21 |
+
|
22 |
+
if not exist "%cd%\env.zip" (
|
23 |
+
echo Download failed, trying with the powershell method
|
24 |
+
powershell -Command "& {Invoke-WebRequest -Uri '%URL_EXTRA%/env.zip' -OutFile 'mingit.zip'}"
|
25 |
+
)
|
26 |
+
|
27 |
+
if not exist "%cd%\env" (
|
28 |
+
echo Extracting the file...
|
29 |
+
powershell -command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory('%cd%\env.zip', '%cd%') }"
|
30 |
+
)
|
31 |
+
|
32 |
+
if not exist "%cd%\env" (
|
33 |
+
echo Extracting failed trying with the tar method...
|
34 |
+
tar -xf %cd%\env.zip
|
35 |
+
)
|
36 |
+
|
37 |
+
if exist "%cd%\env" (
|
38 |
+
del env.zip
|
39 |
+
) else (
|
40 |
+
echo Theres a problem extracting the file please download the file and extract it manually.
|
41 |
+
echo https://huggingface.co/IAHispano/applio/resolve/main/env.zip
|
42 |
+
pause
|
43 |
+
exit
|
44 |
+
)
|
45 |
+
|
46 |
+
if not exist "%CONDA_EXECUTABLE%" (
|
47 |
+
echo Downloading Miniconda from %MINICONDA_DOWNLOAD_URL%...
|
48 |
+
curl %MINICONDA_DOWNLOAD_URL% -o miniconda.exe
|
49 |
+
|
50 |
+
if not exist "%principal%\miniconda.exe" (
|
51 |
+
echo Download failed trying with the powershell method.
|
52 |
+
powershell -Command "& {Invoke-WebRequest -Uri '%MINICONDA_DOWNLOAD_URL%' -OutFile 'miniconda.exe'}"
|
53 |
+
)
|
54 |
+
|
55 |
+
echo Installing Miniconda to %CONDA_ROOT_PREFIX%...
|
56 |
+
start /wait "" miniconda.exe /InstallationType=JustMe /RegisterPython=0 /S /D=%CONDA_ROOT_PREFIX%
|
57 |
+
del miniconda.exe
|
58 |
+
)
|
59 |
+
|
60 |
+
call "%CONDA_ROOT_PREFIX%\_conda.exe" create --no-shortcuts -y -k --prefix "%INSTALL_ENV_DIR%" python=3.9
|
61 |
+
|
62 |
+
echo Installing the dependencies...
|
63 |
+
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%"
|
64 |
+
pip install --upgrade setuptools
|
65 |
+
pip install -r "%principal%\requirements.txt"
|
66 |
+
pip uninstall torch torchvision torchaudio -y
|
67 |
+
pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu121
|
68 |
+
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" deactivate
|
69 |
+
echo.
|
70 |
+
|
71 |
+
echo Applio has been installed successfully, run 'run-applio.bat' to start it!
|
72 |
+
pause
|
73 |
+
cls
|
run-install.sh
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
printf "\033]0;Installer\007"
|
3 |
+
clear
|
4 |
+
rm *.bat
|
5 |
+
|
6 |
+
# Function to create or activate a virtual environment
|
7 |
+
prepare_install() {
|
8 |
+
if [ -d ".venv" ]; then
|
9 |
+
echo "Venv found. This implies Applio has been already installed or this is a broken install"
|
10 |
+
printf "Do you want to execute run-applio.sh? (Y/N): " >&2
|
11 |
+
read -r r
|
12 |
+
r=$(echo "$r" | tr '[:upper:]' '[:lower:]')
|
13 |
+
if [ "$r" = "y" ]; then
|
14 |
+
./run-applio.sh && exit 1
|
15 |
+
else
|
16 |
+
echo "Ok! The installation will continue. Good luck!"
|
17 |
+
fi
|
18 |
+
. .venv/bin/activate
|
19 |
+
else
|
20 |
+
echo "Creating venv..."
|
21 |
+
requirements_file="requirements.txt"
|
22 |
+
echo "Checking if python exists"
|
23 |
+
if command -v python3 > /dev/null 2>&1; then
|
24 |
+
py=$(which python3)
|
25 |
+
echo "Using python3"
|
26 |
+
else
|
27 |
+
if python --version | grep -q 3.; then
|
28 |
+
py=$(which python)
|
29 |
+
echo "Using python"
|
30 |
+
else
|
31 |
+
echo "Please install Python3 or 3.11 manually."
|
32 |
+
exit 1
|
33 |
+
fi
|
34 |
+
fi
|
35 |
+
|
36 |
+
$py -m venv .venv
|
37 |
+
. .venv/bin/activate
|
38 |
+
python -m ensurepip
|
39 |
+
# Update pip within the virtual environment
|
40 |
+
pip3 install --upgrade pip
|
41 |
+
echo
|
42 |
+
echo "Installing Applio dependencies..."
|
43 |
+
python -m pip install -r requirements.txt
|
44 |
+
python -m pip uninstall torch torchvision torchaudio -y
|
45 |
+
python -m pip install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu117
|
46 |
+
finish
|
47 |
+
fi
|
48 |
+
}
|
49 |
+
|
50 |
+
# Function to finish installation (this should install missing dependencies)
|
51 |
+
finish() {
|
52 |
+
# Check if required packages are installed and install them if not
|
53 |
+
if [ -f "${requirements_file}" ]; then
|
54 |
+
installed_packages=$(python -m pip freeze)
|
55 |
+
while IFS= read -r package; do
|
56 |
+
expr "${package}" : "^#.*" > /dev/null && continue
|
57 |
+
package_name=$(echo "${package}" | sed 's/[<>=!].*//')
|
58 |
+
if ! echo "${installed_packages}" | grep -q "${package_name}"; then
|
59 |
+
echo "${package_name} not found. Attempting to install..."
|
60 |
+
python -m pip install --upgrade "${package}"
|
61 |
+
fi
|
62 |
+
done < "${requirements_file}"
|
63 |
+
else
|
64 |
+
echo "${requirements_file} not found. Please ensure the requirements file with required packages exists."
|
65 |
+
exit 1
|
66 |
+
fi
|
67 |
+
clear
|
68 |
+
echo "Applio has been successfully downloaded. Run the file run-applio.sh to run the web interface!"
|
69 |
+
exit 0
|
70 |
+
}
|
71 |
+
|
72 |
+
# Loop to the main menu
|
73 |
+
if [ "$(uname)" = "Darwin" ]; then
|
74 |
+
if ! command -v brew >/dev/null 2>&1; then
|
75 |
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
76 |
+
else
|
77 |
+
brew install python
|
78 |
+
export PYTORCH_ENABLE_MPS_FALLBACK=1
|
79 |
+
export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
|
80 |
+
fi
|
81 |
+
elif [ "$(uname)" != "Linux" ]; then
|
82 |
+
echo "Unsupported operating system. Are you using Windows...?"
|
83 |
+
echo "If yes, use the batch (.bat) file instead of this one!"
|
84 |
+
exit 1
|
85 |
+
fi
|
86 |
+
|
87 |
+
prepare_install
|
run-tensorboard.bat
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@echo off
|
2 |
+
setlocal
|
3 |
+
title Tensorboard
|
4 |
+
|
5 |
+
env\python.exe core.py tensorboard
|
6 |
+
pause
|
run-tensorboard.sh
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
printf "\033]0;Tensorboard\007"
|
3 |
+
. .venv/bin/activate
|
4 |
+
|
5 |
+
clear
|
6 |
+
python core.py tensorboard
|