lucidrains / byol-pytorch

Usable Implementation of "Bootstrap Your Own Latent" self-supervised learning, from Deepmind, in Pytorch
MIT License
1.77k stars 250 forks source link

About target encoder #89

Open ZhaoYuTJPU opened 1 year ago

ZhaoYuTJPU commented 1 year ago

First of all, thanks for your work. I have a question about the parameter update of the Target encoder. As shown in the figure, the function will be executed in each forward process, and then the parameters will be copied from the Online encoder instead of always using the EMA update. I don't understand it very well. I look forward to your reply. image image

lc17721825 commented 1 year ago

I have the same confusion about the projector in online_encoder. The projector is created every time in the forward() of online_encoder. Have you figured it out?

ZhaoYuTJPU commented 1 year ago

Hello. I think I've solved the problem. The function _get_target_encoder has a decorator on it, which makes it run only once, not every time. You can see this process with single-step debugging. I hope this solves your problem.

lc17721825 commented 1 year ago

Thanks for your reply. The projector follows the same situation and uses a decorator.