Pedro Cavalcanti
commited on
Commit
·
f52cc27
1
Parent(s):
2fd6c2c
changing modeling file
Browse files- modeling_florence2.py +4 -1
modeling_florence2.py
CHANGED
|
@@ -2289,6 +2289,7 @@ class Florence2Seq2SeqLMOutput(ModelOutput):
|
|
| 2289 |
image_hidden_states of the model produced by the vision encoder
|
| 2290 |
"""
|
| 2291 |
|
|
|
|
| 2292 |
last_hidden_state: torch.FloatTensor = None
|
| 2293 |
past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
|
| 2294 |
decoder_hidden_states: Optional[Tuple[torch.FloatTensor, ...]] = None
|
|
@@ -2757,6 +2758,8 @@ class Florence2ForConditionalGeneration(Florence2PreTrainedModel):
|
|
| 2757 |
output = (logits,) + outputs[1:]
|
| 2758 |
return (loss,) + output if loss is not None else output
|
| 2759 |
|
|
|
|
|
|
|
| 2760 |
return Florence2Seq2SeqLMOutput(
|
| 2761 |
loss=loss,
|
| 2762 |
logits=logits,
|
|
@@ -2838,4 +2841,4 @@ class Florence2ForConditionalGeneration(Florence2PreTrainedModel):
|
|
| 2838 |
return self.language_model.shift_tokens_right(labels)
|
| 2839 |
|
| 2840 |
def _reorder_cache(self, *args, **kwargs):
|
| 2841 |
-
return self.language_model._reorder_cache(*args, **kwargs)
|
|
|
|
| 2289 |
image_hidden_states of the model produced by the vision encoder
|
| 2290 |
"""
|
| 2291 |
|
| 2292 |
+
loss: torch.FloatTensor = None
|
| 2293 |
last_hidden_state: torch.FloatTensor = None
|
| 2294 |
past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
|
| 2295 |
decoder_hidden_states: Optional[Tuple[torch.FloatTensor, ...]] = None
|
|
|
|
| 2758 |
output = (logits,) + outputs[1:]
|
| 2759 |
return (loss,) + output if loss is not None else output
|
| 2760 |
|
| 2761 |
+
print(loss)
|
| 2762 |
+
|
| 2763 |
return Florence2Seq2SeqLMOutput(
|
| 2764 |
loss=loss,
|
| 2765 |
logits=logits,
|
|
|
|
| 2841 |
return self.language_model.shift_tokens_right(labels)
|
| 2842 |
|
| 2843 |
def _reorder_cache(self, *args, **kwargs):
|
| 2844 |
+
return self.language_model._reorder_cache(*args, **kwargs)
|