salu133445 / bmusegan

Code for “Convolutional Generative Adversarial Networks with Binary Neurons for Polyphonic Music Generation”
https://salu133445.github.io/bmusegan/
MIT License
58 stars 13 forks source link

The second stage train problem #3

Closed ericosmic closed 5 years ago

ericosmic commented 5 years ago

I tried to train bmusegan model by the source code in musegan github , it always stop in the 'initializing variables' step and jump out . So I check the source program and find the problem maybe happen in the main.py , when we choose second_stage training phase , the program still jump into first_stage's class GAN and cause the initial wrong .

salu133445 commented 5 years ago

Could you provide the configuration and error messages so that I can diagnose your problem?

In general, for two stage training, you need to set SETUP['two_stage_training'] to True and CONIFG['training_phase'] to 'pretrain' in the first stage. After you complete the first stage training, you then set CONIFG['training_phase'] to 'train' for the second stage training.

ericosmic commented 5 years ago

My config setup: 2018-11-02 16-53-15 2018-11-02 16-53-49

ericosmic commented 5 years ago

the error message, it just stop running and jump out : 2018-11-02 16-50-44

salu133445 commented 5 years ago

Oh...I see. You are using the source code from another repo (musegan). I found the bug. You need to change the following line in main.py:

if CONFIG['train']['training_phase'] == 'two_stage':

to

if CONFIG['train']['training_phase'] == 'second_stage':
ericosmic commented 5 years ago

Thanks ,I would change the config and retry. Actually , I have another doubt when the mode is training , it would often give a warning like this: 2018-11-02 17-59-36 What is reason about it ?
If it would affect the result of training?

salu133445 commented 5 years ago

That won't affect the training. You can suppress it by modifying part of the source code in function tonal_dist in bmusegan/musegan/utils/metric.py to:

with warnings.catch_warnings():
    warnings.simplefilter("ignore", category=RuntimeWarning)
    chroma1 = chroma1 / np.sum(chroma1)
    chroma2 = chroma2 / np.sum(chroma2)
result1 = np.matmul(tonal_matrix, chroma1)
result2 = np.matmul(tonal_matrix, chroma2)