jacky3102 commited on
Commit
320b8e3
·
verified ·
1 Parent(s): 5a94a5b

Upload 4 files

Browse files
Files changed (4) hide show
  1. .gitignore +4 -0
  2. README.md +55 -0
  3. app.py +48 -0
  4. requirements.txt +51 -0
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ __pycache__/
2
+ *.pyc
3
+ rvc/
4
+ .env
README.md ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: RVC Voice Conversion CPU
3
+ emoji: 🎙️
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: gradio
7
+ app_file: app.py
8
+ app_port: 7860
9
+ pinned: false
10
+ ---
11
+
12
+ # RVC Voice Conversion — Hugging Face CPU Basic
13
+
14
+ CPU-only deployment of the official RVC WebUI.
15
+
16
+ ## What this Space does
17
+
18
+ - Upload an input voice/song
19
+ - Select an RVC `.pth` voice model
20
+ - Optional `.index` retrieval index
21
+ - Convert voice with RVC
22
+ - Supports CPU inference
23
+
24
+ ## Important
25
+
26
+ This Space is intended for **inference**, not RVC model training.
27
+
28
+ You still need an RVC voice model (`.pth`). You can upload/select your own model through the RVC interface.
29
+
30
+ The first startup downloads the RVC inference assets. This can take several minutes.
31
+
32
+ ## CPU performance
33
+
34
+ CPU Basic can run RVC, but it is considerably slower than GPU inference. For long songs, expect substantial processing time.
35
+
36
+ For best CPU performance:
37
+
38
+ - Use RMVPE only when needed.
39
+ - Keep audio reasonably short while testing.
40
+ - Avoid running several conversions simultaneously.
41
+ - Use a smaller/shorter input when troubleshooting.
42
+
43
+ ## Deployment
44
+
45
+ 1. Create a new Hugging Face Space.
46
+ 2. Choose **Gradio**.
47
+ 3. Choose **CPU Basic**.
48
+ 4. Upload `app.py`, `requirements.txt`, and this `README.md`.
49
+ 5. Wait for the Space to build.
50
+ 6. Open the Space after it becomes `Running`.
51
+
52
+ ## Official project
53
+
54
+ RVC-Project / Retrieval-based-Voice-Conversion-WebUI:
55
+ https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI
app.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ import subprocess
4
+ from pathlib import Path
5
+
6
+ # Hugging Face Spaces / CPU-only settings
7
+ os.environ["CUDA_VISIBLE_DEVICES"] = ""
8
+ os.environ["GRADIO_SERVER_NAME"] = "0.0.0.0"
9
+ os.environ["GRADIO_SERVER_PORT"] = "7860"
10
+ os.environ["HF_HUB_DISABLE_TELEMETRY"] = "1"
11
+
12
+ ROOT = Path(__file__).resolve().parent
13
+ RVC_DIR = ROOT / "rvc"
14
+
15
+ def run(cmd, cwd=None):
16
+ print(">>>", " ".join(map(str, cmd)), flush=True)
17
+ subprocess.check_call(cmd, cwd=cwd)
18
+
19
+ # Clone the official RVC WebUI at build/start time so the Space stays small.
20
+ if not (RVC_DIR / "infer-web.py").exists():
21
+ run([
22
+ "git", "clone", "--depth", "1",
23
+ "https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git",
24
+ str(RVC_DIR)
25
+ ])
26
+
27
+ # Make RVC's Python modules importable.
28
+ sys.path.insert(0, str(RVC_DIR))
29
+ os.chdir(RVC_DIR)
30
+
31
+ # Download the inference-only pretrained assets once.
32
+ # RVC's official repository documents hubert_base.pt and rmvpe.pt as required
33
+ # inference assets.
34
+ hubert = RVC_DIR / "assets" / "hubert" / "hubert_base.pt"
35
+ rmvpe = RVC_DIR / "assets" / "rmvpe" / "rmvpe.pt"
36
+
37
+ if not hubert.exists() or not rmvpe.exists():
38
+ downloader = RVC_DIR / "tools" / "download_models.py"
39
+ if downloader.exists():
40
+ run([sys.executable, str(downloader)], cwd=RVC_DIR)
41
+
42
+ # Start the official RVC WebUI on the Space's expected port.
43
+ run([
44
+ sys.executable,
45
+ "infer-web.py",
46
+ "--pycmd", sys.executable,
47
+ "--port", "7860",
48
+ ], cwd=RVC_DIR)
requirements.txt ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RVC official CPU stack for Python 3.12
2
+ --extra-index-url https://download.pytorch.org/whl/cpu
3
+
4
+ torch==2.4.1+cpu
5
+ torchaudio==2.4.1+cpu
6
+ torchvision==0.19.1+cpu
7
+
8
+ setuptools>=75.0,<81
9
+ wheel>=0.45,<1
10
+ packaging>=24.0
11
+
12
+ av>=15.1.0,<16
13
+ einops>=0.8.0,<1
14
+ faiss-cpu>=1.13.0,<2
15
+ ffmpeg-python>=0.2.0,<1
16
+ FreeSimpleGUI>=5.1.0,<5.2
17
+ librosa>=0.10.2,<0.11
18
+ local-attention>=1.11.0,<2
19
+ hyper-connections>=0.1.8,<0.4.3
20
+ matplotlib>=3.8.2,<4
21
+ networkx>=3.2.0,<4
22
+ numpy>=1.26.4,<2
23
+ onnxruntime>=1.24.4,<2
24
+ coloredlogs>=15.0,<16
25
+ opencv-python-headless>=4.10.0,<5
26
+ praat-parselmouth>=0.4.5,<1
27
+ PyYAML>=6.0
28
+ scikit-learn>=1.6.0,<2
29
+ scipy>=1.13.1,<2
30
+ sounddevice>=0.5.0,<1
31
+ soundfile>=0.13.0,<1
32
+ tensorboard>=2.19.0
33
+ torchfcpe>=0.0.4,<0.1
34
+ tqdm>=4.67.0,<5
35
+ transformers>=4.49.0,<4.50
36
+
37
+ # RVC imports fairseq directly.
38
+ fairseq @ git+https://github.com/One-sixth/fairseq.git
39
+
40
+ gradio>=3.14.0,<3.15
41
+ altair>=4.2.0,<5
42
+ anyio>=3.6.2,<4
43
+ fastapi>=0.88.0,<0.100
44
+ httpx>=0.23.0,<0.24
45
+ markdown-it-py>=2.2.0,<3
46
+ mdit-py-plugins>=0.3.3,<0.4
47
+ pydantic>=1.10.13,<2
48
+ pyparsing>=3.0.9,<3.1
49
+ starlette>=0.22.0,<0.28
50
+ websockets>=10.4,<11
51
+ python-dotenv>=1.0,<2