class_docstr: `Callback` that tracks the number of iterations done and properly sets training/eval mode
class_docstr_tok: ["`","Callback","`","that","tracks","the","number","of","iterations","done","and","properly","sets","training\/eval","mode"]
docstr: Set the iter and epoch counters to 0, put the model and the right device
docstr_tok: ["Set","the","iter","and","epoch","counters","to","0",",","put","the","model","and","the","right","device"]
code: def before_fit(self):
      "Set the iter and epoch counters to 0, put the model and the right device"
      self.learn.epoch, self.learn.loss = 0, tensor(0.0)
      self.learn.train_iter, self.learn.pct_train = 0, 0.0
      device = getattr(self.dls, "device", default_device())
      self.model.to(device)
      if isinstance(self.loss_func, (nn.Module, BaseLoss)):
          self.loss_func.to(device)
      if hasattr(self.model, "reset"):
          self.model.reset()
  
imports: from __future__ import annotations
  from ..data.all import *
  from ..optimizer import *
  from ..losses import BaseLoss
label_desc: Use image node_id 2 for calling the TrainEvalCallback obj's underlying member method code with example usage: obj.before_fit() without return types