Skip to content

Building on top of https://github.com/IraKorshunova/folk-rnn/ and introducing a 'critic' that actively learns from feedback provided by a human in the loop

Notifications You must be signed in to change notification settings

fredrikmalmberg/folkcritic

Repository files navigation

folkcritic

Building on top of https://github.com/IraKorshunova/folk-rnn/ and introducing a 'critic' that actively learns from feedback provided by a human in the loop

Setting up the webserver

if using conda and Linux

$ conda create -n folkcritic --file requirements.txt

if using an ARM based Mac

$ conda env create -n folkcritic -f arm_requirements.yaml

Activating the environment

$ conda activate folkcritic

update database

$ python manage.py makemigrations $ python manage.py migrate

create a user

$ python manage.py createsuperuser

Running the server

$ python manage.py runserver

Using the webserver and training the critic

  1. Navigate to 127.0.0.1:8000 and log in using the super user credentials to start training the critic (alternatively, navigate to the admin gui, 127.0.0.1:8000/admin, to create additional users)

Screenshot 2022-10-22 at 14 07 27

Setting up a session

Folkcritic can handle multiple sessions per user and all sessions are continously stored which means it is possible to go back and continue with a previous session at any time. Screenshot 2022-10-22 at 14 13 03

Training the critic

The main window shows the score and ABC notation of a song that has been generated by Folk RNN. It is possible to listen to the song by pressing Space bar, to like or dislike the song by pressing either the buttons or x and c respectively. The bottom displays information about the critic, such as how many songs it has been trained on and the critic score of the currently displayed song. Screenshot 2022-10-22 at 14 23 16

A higher critic score indicates a more likeable song. The system generates songs in the background until there is a song generated with a critic score above 0.5 or a total of 5 songs have been generated in which case the best scoring one is displayed.

  1. Liking or disliking a song retrains the critic and generates a new song that passes the criteria above
  2. It is possible to change the training parameters of the critic at any time and retrain it with all the songs that have been liked/disliked during the session
  3. It is also possible to reset the critic but it is worth noting that every time a new song is liked or disliked the critic is retrained on all the songs in the current session
  4. It is always possible to change the session or create a new one
  5. After enough training is done, the critic can be evaluated to see if it has managed to learn the preferences of the user

Evaluating the critic

It is possible to evaluate the critic on any number of songs. Half of the songs are generated using the trained critic while the other half is generated using an untrained critic. The songs are then displayed to the user in random order and liked/disliked similar to the training but without displaying the critic score to the user. Screenshot 2022-10-22 at 14 51 16

After the user has liked/disliked the songs the result of the evaluation is displayed indicating whether the trained critic outperforms the untrained one. Screenshot 2022-10-22 at 14 58 33

Further improvements

It should be noted that the setup could be improved significantly by increasing the complexity of the TF model used for the critic. Currently only one layer is used which means the model just weighs the input and is not capable of really learning anything significant. Another obvious limitation is the number of songs generated before displaying a song to the user. If the critic is trained on a larger number of songs it would be beneficial to increase this number from 5 that is currently used. As the critic learns the average score of the songs from the generator tends to decrease which means fewer songs actually pass the critics scrutiny.

About

Building on top of https://github.com/IraKorshunova/folk-rnn/ and introducing a 'critic' that actively learns from feedback provided by a human in the loop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published