How to use Magenta and Tensorflow to generate music in a free Google Cloud instance
Aprašymas
[This is a reupload with increased volume]
This tutorial explains how to use Magenta, Tensorflow, and the Tesla K80 GPU we signed up for in the last video to generate new midi music files from a training set of your choosing.
Some of the URLs in these commands are truncated because google just thinks they're links. For the full text, go here: https://pastebin.com/raw/35fKF8Sc
05:30 https://www.youtube.com/watch?v=IEa8hIvkto0
05:40 https://www.youtube.com/watch?v=abEf3wQJBmE
05:50 https://console.cloud.google.com/compute/instances
05:57 https://cloud.google.com/compute/docs/gpus/add-gpus
06:10 https://pastebin.com/raw/U7fQFiZd
06:23 sudo apt-get update
06:27 sudo apt-get install ipython
06:28 sudo apt-get install python3-pip
06:36 sudo apt-get install python-pip
06:40 sudo pip3 install jupyter
06:47 sudo pip install numpy scipy matplotlib ipython jupyter pandas sympy nose
06:50 sudo apt-get install openjdk-8-jdk git python-dev python3-dev python-numpy python3-numpy python-six python3-six build-essential python-pip python3-pip python-virtualenv swig python-wheel python3-wheel libcurl3-dev libcupti-dev
07:08 https://alliseesolutions.wordpress.com/2016/09/08/install-gpu-tensorflow-from-sources-w-ubuntu-16-04-and-cuda-8-0-rc/
07:10 tar -xzvf cudnn-8.0-linux-x64-v5.1.tgz
07:12 sudo cp cuda/include/cudnn.h /usr/local/cuda/include
07:13 sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
07:13 sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
07:14 nano ~/.bashrc
07:16 add these lines:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda
07:24 source ~/.bashrc
07:27 echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
07:28 curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
07:29 sudo apt-get update
07:30 sudo apt-get install bazel
07:30 sudo apt-get upgrade bazel
07:32 git clone https://github.com/tensorflow/tensorflow
07:52 cd ~/tensorflow
07:55 ./configure
8:05 at the "Do you wish to build TensorFlow with CUDA support?" question answer "y"
08:07 3.7
08:11 bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
08:19 bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
08:22 sudo pip install /tmp/tensorflow_pkg/tensorflow[PRESS TAB TO COMPLETE FILENAME]
08:30 sudo pip install magenta
(Now quit the SSH window and come back)
08:39 sudo jupyter notebook --ip 0.0.0.0 --port 8888 --allow-root
08:43 sudo apt-get install zip
9:12 https://github.com/tensorflow/magenta/tree/master/magenta/scripts
convert_dir_to_note_sequences \
--input_dir=~/midis/ \
--output_file=~/notesequences.tfrecord \
--recursive
9:40 https://github.com/tensorflow/magenta/tree/master/magenta/models/melody_rnn
melody_rnn_create_dataset \
--config=basic_rnn \
--input=~/notesequences.tfrecord \
--output_dir=~/sequence_examples \
--eval_ratio=0.10
10:40
melody_rnn_train \
--config=attention_rnn \
--run_dir=/tmp/melody_rnn/logdir/run1 \
--sequence_example_file=~/sequence_examples/training_melodies.tfrecord \
--num_training_steps=20000
11:32
melody_rnn_generate \
--config=basic_rnn \
--run_dir=/tmp/melody_rnn/logdir/run1 \
--output_dir=~/generated \
--num_outputs=10 \
--num_steps=128 \
--primer_melody="[60]"