sky-2002 commited on
Commit
b5b0b57
1 Parent(s): 60100f0

Florence2LanguageForConditionalGeneration has no shift_tokens_right method defined in the class

Browse files

Call `prepare_decoder_input_ids_from_labels` instead of `shift_tokens_right` as it is not defined in `Florence2LanguageForConditionalGeneration`

Files changed (1) hide show
  1. modeling_florence2.py +1 -1
modeling_florence2.py CHANGED
@@ -2841,7 +2841,7 @@ class Florence2ForConditionalGeneration(Florence2PreTrainedModel):
2841
  }
2842
 
2843
  def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor):
2844
- return self.language_model.shift_tokens_right(labels)
2845
 
2846
  def _reorder_cache(self, *args, **kwargs):
2847
  return self.language_model._reorder_cache(*args, **kwargs)
 
2841
  }
2842
 
2843
  def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor):
2844
+ return self.language_model.prepare_decoder_input_ids_from_labels(labels)
2845
 
2846
  def _reorder_cache(self, *args, **kwargs):
2847
  return self.language_model._reorder_cache(*args, **kwargs)