Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Way to generate more melodies sequences #16

Open
valientegaston opened this issue Apr 7, 2023 · 12 comments
Open

Way to generate more melodies sequences #16

valientegaston opened this issue Apr 7, 2023 · 12 comments

Comments

@valientegaston
Copy link

Thanks for the previous answer. I have tried and it effectively lengthens the duration of the theme, but repeating the same thing over and over again. Is there a way to generate more sequences of different melodies to have a more extensive musical track but not for that reason repetitive?

@jacbz
Copy link
Owner

jacbz commented Apr 7, 2023

I'm afraid that's not possible without retraining the model. You can adjust the parameters before training.

MAX_CHORD_LENGTH = 50

@valientegaston
Copy link
Author

valientegaston commented Apr 10, 2023

Thanks for the reply. I am trying to retrain the model. I have changed the parameter that you have indicated from 50 to 200. If with 50 I obtain 1:30 minutes, I expect to obtain 4 times more with 200. I have followed the instructions in the model/dataset readme file and I have been able to obtain the "processed" folder with 15 files, but it says "Result: 0 samples", is that correct? Or am I doing something wrong? Thank you so much

gaston@iMac dataset % python3 preprocessor.py
preprocessor.py:70: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(json_data["tracks"]["melody"]) is 0 or all(
preprocessor.py:75: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(json_data["tracks"]["chord"]) is 0 or all(
Result: 0 samples
gaston@iMac dataset % cd .. 
gaston@iMac model % ls
README.md		embeddings.py		lyrics2lofi_model.py
__init__.py		lofi2lofi_dataset.py	lyrics2lofi_train.py
constants.py		lofi2lofi_model.py	train.py
dataset			lofi2lofi_train.py
dataset.py		lyrics2lofi_dataset.py
gaston@iMac model % python3 lofi2lofi_train.py 
Traceback (most recent call last):
  File "lofi2lofi_train.py", line 3, in <module>
    from model.lofi2lofi_dataset import Lofi2LofiDataset
ModuleNotFoundError: No module named 'model'
gaston@iMac model % 

These are the generated files

gaston@iMac model % cd dataset gaston@iMac dataset % ls README.md preprocessor.py spotify_client_id hooktheory processed spotify_client_secret gaston@iMac dataset % cd processed gaston@iMac processed % ls X Ambassadors - Unsteady - intro.json Xi - Freedom Dive - intro.json Xi - Freedom Dive - verse.json Xilent - Animation - chorus-lead-out.json Xilent - Animation - chorus.json Xilent - Choose Me - chorus.json Xilent - Choose Me - intro-and-verse.json Xilent - Disconnect - instrumental.json Xilent - Synthony - chorus.json Xilent - The Place - chorus.json Xilent - The Place - instrumental.json Xxanaxx - Give U The World - chorus.json Xxanaxx - Got U Under Spisek Jednego Remix - verse-and-pre-chorus.json Xxanaxx - Story - intro-and-verse.json Xxanaxx - Story - pre-chorus-and-chorus.json gaston@iMac processed %

@jacbz
Copy link
Owner

jacbz commented Apr 10, 2023

The dataset should contain more than 10,000 files. I'm not quite sure what went wrong on your machine.

@valientegaston
Copy link
Author

Where should those 15 thousand files come from? From Spotify?

@valientegaston
Copy link
Author

Should the hooktheory folder look like this?

Captura de Pantalla 2023-04-10 a la(s) 20 46 34

@jacbz
Copy link
Owner

jacbz commented Apr 11, 2023

It seems you downloaded the repo directly, which only contains an excerpt of the whole dataset. The repo links to a bigger 4.9 GB dataset in its readme.

@valientegaston
Copy link
Author

valientegaston commented Apr 11, 2023

Thank you very much for your patience. I already have more than 17 thousand files inside the processed folder. After that I tried to run lofi2lofi_train and it threw an error that it couldn't find the folder 'dataset/processed-spotify-all'
I renamed the processed folder to that folder I was looking for and started with the following...

%sudo python3 lofi2lofi_train.py
Using cpu device
Starting training: lofi2lofi
== Epoch 0 ==
Scheduled sampling rate: C 0, M 0
Batch 0: Loss 5.503 (C: 2.198 + KL: 0.016 + M: 2.704 + T: 0.069 + K: 0.084 + Mo: 0.200 + V: 0.123 + E: 0.108)
Batch 1: Loss 5.445 (C: 2.186 + KL: 0.017 + M: 2.683 + T: 0.065 + K: 0.082 + Mo: 0.194 + V: 0.112 + E: 0.107)
Batch 2: Loss 5.386 (C: 2.172 + KL: 0.027 + M: 2.668 + T: 0.057 + K: 0.083 + Mo: 0.196 + V: 0.092 + E: 0.091)
Batch 3: Loss 5.325 (C: 2.152 + KL: 0.040 + M: 2.651 + T: 0.050 + K: 0.081 + Mo: 0.191 + V: 0.082 + E: 0.077)
Batch 4: Loss 5.315 (C: 2.147 + KL: 0.054 + M: 2.647 + T: 0.054 + K: 0.081 + Mo: 0.183 + V: 0.074 + E: 0.074)
Batch 5: Loss 5.275 (C: 2.152 + KL: 0.058 + M: 2.626 + T: 0.049 + K: 0.082 + Mo: 0.181 + V: 0.069 + E: 0.059)
Batch 6: Loss 5.192 (C: 2.128 + KL: 0.055 + M: 2.584 + T: 0.044 + K: 0.084 + Mo: 0.177 + V: 0.058 + E: 0.061)
Batch 7: Loss 5.133 (C: 2.091 + KL: 0.053 + M: 2.579 + T: 0.047 + K: 0.082 + Mo: 0.173 + V: 0.056 + E: 0.052)
Batch 8: Loss 5.084 (C: 2.075 + KL: 0.050 + M: 2.551 + T: 0.047 + K: 0.083 + Mo: 0.168 + V: 0.058 + E: 0.052)
Batch 9: Loss 5.087 (C: 2.062 + KL: 0.049 + M: 2.570 + T: 0.045 + K: 0.082 + Mo: 0.166 + V: 0.059 + E: 0.055)
Batch 10: Loss 5.045 (C: 2.065 + KL: 0.046 + M: 2.539 + T: 0.044 + K: 0.083 + Mo: 0.163 + V: 0.057 + E: 0.049)
Batch 11: Loss 5.003 (C: 2.032 + KL: 0.043 + M: 2.528 + T: 0.046 + K: 0.083 + Mo: 0.160 + V: 0.060 + E: 0.052)
Batch 12: Loss 5.017 (C: 2.080 + KL: 0.040 + M: 2.503 + T: 0.044 + K: 0.083 + Mo: 0.158 + V: 0.061 + E: 0.049)
Batch 13: Loss 4.968 (C: 2.029 + KL: 0.037 + M: 2.507 + T: 0.044 + K: 0.082 + Mo: 0.158 + V: 0.061 + E: 0.050)
Batch 14: Loss 5.052 (C: 2.092 + KL: 0.035 + M: 2.535 + T: 0.046 + K: 0.082 + Mo: 0.158 + V: 0.056 + E: 0.049)
Batch 15: Loss 4.964 (C: 2.045 + KL: 0.037 + M: 2.505 + T: 0.042 + K: 0.082 + Mo: 0.149 + V: 0.053 + E: 0.052)
Batch 16: Loss 4.989 (C: 2.031 + KL: 0.033 + M: 2.529 + T: 0.044 + K: 0.081 + Mo: 0.153 + V: 0.063 + E: 0.054)
Batch 17: Loss 5.016 (C: 2.070 + KL: 0.034 + M: 2.539 + T: 0.043 + K: 0.083 + Mo: 0.144 + V: 0.051 + E: 0.051)

Is this what this is expected to do? What files should that output generate? Is it okay to rename the processed folder to processed-spotify-all? How many batch processes should this run? About 17 thousand?
Thank you very much for helping me move forward.

@valientegaston
Copy link
Author

I've changed MAX_CHORD_LENGTH = 400 in constants.py, I've retrained the model, but I'm still getting songs of 1:30 min.... do I need to change something else for a longer duration? I have tried changing MELODY_PREDICTION_LENGTH, to *4 , but it gives compile error. Of the files generated after the retraining, I only copy the lofi2lofi_decoder.pth to the checkpoints folder, is that correct? Can anybody help me? Thank you so much.

@valientegaston
Copy link
Author

valientegaston commented Apr 14, 2023

I've finally been able to retrain the AI. I've made changes to MAX_CHORD_LENGTH and MELODY_PREDICTION_LENGTH hoping to get longer songs but to no avail. In the early stages of training, epoch0 does generate songs up to 20 minutes long, but then as the AI ​​training progresses, it falls to around 1:30 minutes every time it is generated. Perhaps it is due to the input dataset, where the AI ​​learns that the songs should last that minute and a half, and for that reason it does not generate longer songs, and simply the 20-minute ones obtained at the beginning is bad learning or ignorance of the AI . I don't know what else I can change, so I leave the topic here until I see if someone can achieve it, or if it is directly not possible with this model. Thank you so much.

@ManHinnn0509
Copy link

Hey man, thank you so much for the detailed follow up with your training progress.
I just got everything to work but I don't understand when I should stop training the model? At around how many epoch?
A figure were shown after each epoch but I don't really understand it.

Looking for help on this, thanks!

@tesh254
Copy link

tesh254 commented Sep 21, 2023

@valientegaston edit lofi2lofi_train.py line 8 to dataset_folder = "dataset/processed"

@AryanNanda17
Copy link

AryanNanda17 commented Dec 24, 2023

Heyy
How did you lengthen the music... although it is repeating still!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants