younggyoseo / vae-cf-pytorch

Variational Autoencoders for Collaborative Filtering - Implementation in PyTorch
130 stars 22 forks source link

Misleading anneal calculation #6

Open rat-nick opened 1 year ago

rat-nick commented 1 year ago

https://github.com/younggyoseo/vae-cf-pytorch/blob/3619878f8eaf77f4018be697f1ecfdbd95f9a23b/main.py#L114-L115

The second parameter of the min function can hit anneal_cap before update_count can reach args.total_anneal_steps. If I understood the logic correctly based on variable naming, it should take args.total_anneal_steps for the anneal variable to go from 0 to anneal_cap in a linear fashion.

The proposed solution is to do the following:

anneal = min(args.anneal_cap, args.anneal_cap * update_count / args.total_anneal_steps) 

If this is the case I would be happy to open a pull request to fix this.