DequanWang / tent

ICLR21 Tent: Fully Test-Time Adaptation by Entropy Minimization
https://arxiv.org/abs/2006.10726
MIT License
344 stars 43 forks source link

training loss value is always 0 #13

Closed JohnMasoner closed 2 years ago

JohnMasoner commented 2 years ago

Hi @DequanWang ,

Thanks for you open source the code firstly, I try to use the model as my paper baseline, but the training loss value is always 0.

My training script code following,

self.model.train()
self.model = tent.configure_model(self.model)
params, _ = tent.collect_params(self.model)
self.optimizer = optim.Adam(params, lr=3e-4)
tent_model = tent.Tent(self.model, self.optimizer)

for idx, data in enumerate(self.train_loader):
        image = data['img'].type(torch.FloatTensor).cuda(non_blocking=True)

        output, loss = tent_model(image)

It's worth mentioning that this happens whether I load the model or not.

Looking Forward to Hearing from You.

JohnMasoner commented 2 years ago

ohhh, this is my wrong, i didn't understand the paper. now i sloved the problem.