Hacer música con inteligencia artificial

Fuente https://github.com/openai/jukebox

Primero instalar conda

apt-get update
apt-get install -y python wget git python3-soundfile
aduser jukebox
su - jukebox
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

sed -i 's/^\#\!\/bin\/sh/\#\!\/bin\/bash/g' Miniconda3-latest-Linux-x86_64.sh 

chmod +x Miniconda3-latest-Linux-x86_64.sh 
./Miniconda3-latest-Linux-x86_64.sh

Si queremos desactivar conda en el prompt de bash:

conda config --set auto_activate_base false

Ahora instalamos jukebox según https://github.com/openai/jukebox

conda create --name jukebox python=3.7.5
conda activate jukebox
conda install mpi4py=3.0.3 # if this fails, try: pip install mpi4py==3.0.3
conda install pytorch=1.4 torchvision=0.5 cudatoolkit=10.0 -c pytorch
git clone https://github.com/openai/jukebox.git
cd jukebox
pip install -r requirements.txt
pip install -e .

Lanzamos el comando:

python jukebox/sample.py --model=5b_lyrics --name=sample_5b_prompted --levels=3 --mode=primed --audio_file=carnaza2.wav --prompt_length_in_seconds=12 --sample_length_in_seconds=20 --total_sample_length_in_seconds=180 --sr=44100 --n_samples=6 --hop_fraction=0.5,0.5,0.125

Si no tiene nvidia configurada da este error:

Found no NVIDIA driver on your system. Please check that you
have an NVIDIA GPU and installed a driver from
http://www.nvidia.com/Download/index.aspx