Problems with a custom model using a transformer base model in the evaluation phase (eval_strategy)
HiI am trying to create a custom model using thetransformslibrary, specifically the ViT model.So to have some benchmark, my goal is to replicate theViTForImageClassificationclass, only adding a linear layer on top of theViTModeloutput.But I experience some problems during the evaluation phase when I used myViTCustommodel. If I set the argumentevaluation_stage="no"inside the functionTrainingArguments(),the model update the parameters, and the training loss starts to decrease and reach similar levels that comparing with theViTForImageClassification(good, sanity check). But, when I setevaluation_strategy="steps"the model returns the following error:/usr/local/lib/python3.7/dist-packages/transformers/optimization.py:310: FutureWarning: This implementation of AdamW is deprecated and will be removed in a future version. Use the PyTorch implementation torch.optim.AdamW instead, or set `no_deprecation_warning=True` to disable this warning
  FutureWarning,
***** Running training *****
  Num examples = 1451
  Num Epochs = 4
  Instantaneous batch size per device = 16
  Total train batch size (w. parallel, distributed & accumulation) = 16
  Gradient Accumulation steps = 1
  Total optimization steps = 364
 [101/364 00:30 < 01:20, 3.28 it/s, Epoch 1.10/4]
Step	Training Loss	Validation Loss
***** Running Evaluation *****
  Num examples = 170
  Batch size = 8
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-59-5bdd51e9c139> in <module>
----> 1 train_results = trainer.train()
      2 trainer.save_model()
      3 trainer.log_metrics("train", train_results.metrics)
      4 trainer.save_metrics("train", train_results.metrics)
      5 trainer.save_state()

8 frames
/usr/local/lib/python3.7/dist-packages/transformers/trainer_pt_utils.py in nested_detach(tensors)
    158     if isinstance(tensors, (list, tuple)):
    159         return type(tensors)(nested_detach(t) for t in tensors)
--> 160     return tensors.detach()
    161 
    162 

AttributeError: 'NoneType' object has no attribute 'detach'Does anyone that faced some similar issue have an idea why theViTCustommodel returns a ‘NoneType’ on evaluation mode that raises an error trying to detach the tensors?best,Cristóbal