0

I want to generate music with magenta and a neural network model for a project.

I found this simple example and wanted to try it first to understand how it works: https://www.twilio.com/blog/training-a-neural-network-on-midi-music-data-with-magenta-and-python

Apparently i have to modify the type of my inital data (which is midi file) "in note to sequences"

Here is what i have:

convert_dir_to_note_sequences \
  --input_dir == 'C:\Users\mista\Downloads\CLEANED_DATA\CLEANED_DATA' \
  --output_file = tmp/notesequences.tfrecord \
  --recursive

and here is the error i get:

File "C:\Users\mista\AppData\Local\Temp/ipykernel_28328/3757950315.py", line 3 --output_file = tmp/notesequences.tfrecord
^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

I saw some people saying that you could use an 'r' before your path to solve this but i've tried many ways, i'm still stuck

twix yon
  • 1
  • 1
  • Sorry, but what exactly are you doing? Please keep in mind that we don't know what you're doing and shouldn't guess, so be precise! As a new user here, also take the [tour] and read [ask]. – Ulrich Eckhardt Jun 02 '22 at 20:27
  • @UlrichEckhardt Hi, thanks for you comment, i've edited my inital post. I hope it is less confusing now. – twix yon Jun 03 '22 at 08:55

1 Answers1

0

I am following the same tutorial and after a couple hours of bashing my head against the keyboard, I managed to run the neural net properly. It seems like the problem is a lot of conflicting dependencies and deprecations, so you may have to play around with what version of Python you're using once you set everything else up properly (I used Python 3.7 and did pip install magenta).

I used Powershell (right click on Windows home button --> run Powershell as admin). You'll want to set up a virtual environment in your current working directory, as the tutorial advises. And now we get to your problem in particular - make sure you're running the command all in one line, as such:

convert_dir_to_note_sequences --input_dir == 'C:\Users\mista\Downloads\CLEANED_DATA\CLEANED_DATA' --output_file = tmp/notesequences.tfrecord --recursive

That should start converting all the midi files to NoteSequences objects. If you have any more trouble, please follow up and I'll see what I can do to help.

  • Hi man, Thanks a lot, i was just coming back to say that with some help i finnally found a solution as well, i put it in one line and also used a "!" before my command because i wasn't working on a terminal. Did you manage to finish the tutorial ? – twix yon Jun 07 '22 at 08:39
  • Nice, glad you found a resolution! I haven't finished it yet cause I got an error after the neural net was finished training, and I have yet to debug it. Fingers crossed – Ken Cox Jun 08 '22 at 15:57