1 Star 0 Fork 0

Yangchl/MSST-WebUI

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webUI_for_colab.ipynb 7.16 KB
一键复制 编辑 原始数据 按行查看 历史
Sucial 提交于 10个月前 . Support for release 1.5.1

Music-Source-Separation-Training-Inference-Webui For Google Colab

For personal entertainment and non-commercial use only. Prohibited from use in content related to blood, gore, violence, sex, politics.
Author: Github@KitsuneX07 | Github@SUC-DriverOld | Gradio theme: Gradio Theme
Github: MSST-WebUI

Introduction

This is a webUI for Music-Source-Separation-Training, which is a music source separation training framework. You can use this webUI to infer the MSST model and UVR VR.Models (The inference code comes from python-audio-separator, and we do some changes on it), and the preset process page allows you to customize the processing flow yourself. When used on the cloud, you don't need to download the model yourself. WebUI will automatically download the model you need. Finally, we also provide some convenient tools such as SOME: Vocals to MIDI in the webUI.

#@title Connect to colab runtime and check GPU
#@markdown # Connect to colab runtime and check GPU
#@markdown

!nvidia-smi
#@title Install python 3.10, ffmpeg
#@markdown # Install python 3.10, ffmpeg
#@markdown

!sudo apt install python3.10
!sudo apt install ffmpeg
#@title Clone repository and install requirements
#@markdown # Clone repository and install requirements
#@markdown
#@markdown ### You may need to rerun this cell for a few times
#@markdown

!git clone https://github.com/SUC-DriverOld/MSST-WebUI.git
%cd /content/MSST-WebUI
%pip install --upgrade pip setuptools
%pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
%pip install tools/webUI_for_clouds/librosa-0.9.2-py3-none-any.whl
%pip install -r requirements.txt
#@title [Optional] Download SOME weights if needed
#@markdown # Download SOME weights if needed
#@markdown
#@markdown ### If you want to use "Vocals to MIDI", download the weights.
#@markdown
#@markdown ### "Vocals to MIDI" use project: [SOME](https://github.com/openvpi/SOME/).
#@markdown

!wget https://huggingface.co/Sucial/SOME_Models/resolve/main/model_steps_64000_simplified.ckpt -O /content/MSST-WebUI/tools/SOME_weights/model_steps_64000_simplified.ckpt
#@title [Optional] Pack and upload your music files to your google drive
#@markdown # Pack and upload your music files to your google drive
#@markdown
#@markdown Ensure that there are no nested folders in your zip file, but rather direct audio files.
#@markdown
from google.colab import drive
drive.mount("/content/drive")
#@markdown Directory where **your zip file** located in, dont miss the slash at the end.
data_dir = "/content/drive/MyDrive/MSST-WebUI/"  #@param {type:"string"}
#@markdown Filename of **your zip file**, for example: "inputs.zip"
zip_filename = "input.zip"  #@param {type:"string"}
ZIP_PATH = data_dir + zip_filename
#@markdown The compressed file will be extracted to the `input` directory. If there are files in your `input` directory, they will be deleted. Please backup in advance.
#@markdown

!rm -rf /content/MSST-WebUI/input
!mkdir -p /content/MSST-WebUI/input
!unzip -od /content/MSST-WebUI/input {ZIP_PATH}
#@title [Optional] Save results to google drive
#@markdown # Save results to google drive
#@markdown
#@markdown The results audio files in the output directory will be compressed into a zip file and saved to your google drive.
#@markdown
from google.colab import drive
drive.mount("/content/drive")
#@markdown Path to save the zip file, dont miss the slash at the end.
output_dir = "/content/drive/MyDrive/MSST-WebUI/"  #@param {type:"string"}
#@markdown Filename of the zip file, for example: "Outputs.zip"
zip_filename = "Outputs.zip"  #@param {type:"string"}
ZIP_PATH = output_dir + zip_filename

!mkdir -p {output_dir}
!zip -r "{zip_filename}" /content/MSST-WebUI/results
!cp -vr "{zip_filename}" {output_dir}
#@title Initialize and start WebUI
#@markdown # Initialize and start WebUI
#@markdown
#@markdown ### Select the language you want to use for the WebUI.
#@markdown
#@markdown ### After running this cell, you can use your own device to connect to WebUI. The public link will be displayed below.
#@markdown

%cd /content/MSST-WebUI

LANGUAGE = "English" #@param ["Auto", "English", "简体中文", "繁體中文", "日本語", "😊"]

import json
import os
import shutil

language_dict = {"Auto": "Auto", "简体中文": "zh_CN", "繁體中文": "zh_TW", "English": "en_US", "日本語": "ja_JP", "😊": "emoji"}

if not os.path.exists("data"):
    shutil.copytree("data_backup", "data")
if not os.path.exists("configs"):
    shutil.copytree("configs_backup", "configs")
if not os.path.exists("input"): os.makedirs("input")
if not os.path.exists("results"): os.makedirs("results")

with open("data/webui_config.json", 'r', encoding="utf-8") as f:
    config = json.load(f)
    config['settings']['language'] = language_dict[LANGUAGE]
with open("data/webui_config.json", 'w', encoding="utf-8") as f:
    json.dump(config, f, indent=4)

!python tools/webUI_for_clouds/webUI_for_clouds.py
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/Yang-chl/MSST-WebUI.git
git@gitee.com:Yang-chl/MSST-WebUI.git
Yang-chl
MSST-WebUI
MSST-WebUI
main

搜索帮助