<jupyter_start><jupyter_text>Code/Environment PreparationLet's start by installing nnabla and other required packages first. If you're running on Colab, make sure that your Runtime setting is set as GPU. If not, that can be set up from the top menu (Runtime → change runtime type). Then click Connect on the top right-hand side of the screen before you start.<jupyter_code>!pip install soundfile librosa pydub nnabla-ext-cuda100
!pip install --upgrade PyYAML<jupyter_output><empty_output><jupyter_text>Next, clone the code from sony/ai-research-code repository, and then download the [pre-trained weights](https://nnabla.org/pretrained-models/ai-research-code/d3net/mss/d3net-mss.h5) to test on music files(only wav format).<jupyter_code>!git clone https://github.com/sony/ai-research-code.git
%cd ai-research-code/d3net/music-source-separation
!wget https://nnabla.org/pretrained-models/ai-research-code/d3net/mss/d3net-mss.h5<jupyter_output><empty_output><jupyter_text>TestingIf you do not have sample music files, such files can be downloaded from [this link](https://www.ee.columbia.edu/~dpwe/sounds/music/).<jupyter_code>#To upload music files from local machine

from google.colab import files
uploaded_file = files.upload()
filename = list(uploaded_file.keys())[0]
!python separate.py  -i $filename -o ./output/<jupyter_output><empty_output><jupyter_text>Listen To Audio Seperated Files<jupyter_code>#@title Choose a separate track

sub_folder_name = filename.split('.')[0].split('/')[-1]
track = 'vocals' #@param ["bass", "drums", "vocals", "other"]
import IPython.display as ipd
ipd.Audio(f'output/{sub_folder_name}/{track}.wav')<jupyter_output><empty_output><jupyter_text>Testing with openvinoYou can also test this model on openvino to make the inference faster. First, you need install openvino.<jupyter_code>!pip install openvino<jupyter_output><empty_output><jupyter_text>Next, download and extract the openvino weights.<jupyter_code>!wget https://nnabla.org/pretrained-models/ai-research-code/d3net/mss/d3net-openvino.zip
!unzip d3net-openvino.zip -d openvino_models<jupyter_output><empty_output><jupyter_text>Do audio separation with openvino.<jupyter_code>!python separate_with_openvino.py  -i $filename -o ./ov_output/ -m ./openvino_models<jupyter_output><empty_output><jupyter_text>Listen To Audio Seperated Files<jupyter_code>#@title Choose a separate track

sub_folder_name = filename.split('.')[0].split('/')[-1]
track = 'vocals' #@param ["bass", "drums", "vocals", "other"]
import IPython.display as ipd
ipd.Audio(f'ov_output/{sub_folder_name}/{track}.wav')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12337164750957855, 'fraction_numerical': 0.006896551724137931, 'mean_word_length': 6.546242774566474, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 5, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '270404', 'license': 'MIT', 'n_tokens_mistral': 926, 'n_tokens_neox': 902, 'n_words': 212, 'path': 'd3net/music-source-separation/D3Net-MSS.ipynb', 'repo_name': 'alvesfelipe/ai-research-code', 'size': '2610'}