mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Adapt has_labels test when no labels were found (#20113)
* Make default labels for non-pretrained models * Fix the has_labels test instead
This commit is contained in:
parent
e2a23b6ce9
commit
c08a1e26ab
@ -3189,7 +3189,7 @@ class Trainer:
|
||||
Tuple[Optional[torch.Tensor], Optional[torch.Tensor], Optional[torch.Tensor]]: A tuple with the loss,
|
||||
logits and labels (each being optional).
|
||||
"""
|
||||
has_labels = all(inputs.get(k) is not None for k in self.label_names)
|
||||
has_labels = False if len(self.label_names) == 0 else all(inputs.get(k) is not None for k in self.label_names)
|
||||
inputs = self._prepare_inputs(inputs)
|
||||
if ignore_keys is None:
|
||||
if hasattr(self.model, "config"):
|
||||
|
Loading…
Reference in New Issue
Block a user