The following is the training_step function in ResNet model. Why there is no train_acc displayed in the
progress_bar at each epoch? Could someone help me with this problem? I look forward to hearing from you.
Thanks in advance!
def training_step(self,batch,batch_idx):
x,y=batch
b=x.size(0)
x=x.view(b,-1)
logits= self(x)
J=self.loss(logits,y)
acc=accuracy(logits,y)
pbar={‘train_acc’:acc}
return {‘loss’:J,‘progress_bar’:pbar}
model=ResNet()
trainer=pl.Trainer(progress_bar_refresh_rate=20,max_epochs=5,gpus=1)
trainer.fit(model)
Running results:
Epoch 4: 100%
1875/1875 [00:18<00:00, 102.97it/s, loss=0.211, v_num=0]