timbmg / Sentence-VAE

PyTorch Re-Implementation of "Generating Sentences from a Continuous Space" by Bowman et al 2015 https://arxiv.org/abs/1511.06349
580 stars 152 forks source link

maybe a bug in the kl_anneal_function #19

Closed linzhk closed 4 years ago

linzhk commented 4 years ago

in the function :

def kl_anneal_function(anneal_function, step, k, x0):

    if anneal_function == 'logistic':  

        return float(1/(1+np.exp(-k*(step-x0))))  

    elif anneal_function == 'linear':  

        return min(1, step/x0)  

you will see k is a str.that is wrong and i change it into 1

timbmg commented 4 years ago

It shouldn't be a string. It comes from the command line, see here: parser.add_argument('-k', '--k', type=float, default=0.0025)