Skip to content

Commit

Permalink
Merge pull request #3491 from sheldon-roberts/master
Browse files Browse the repository at this point in the history
Fix TextRegressor label_name bug
  • Loading branch information
helpmefindaname authored Jul 4, 2024
2 parents afedf3c + 02f259f commit 355e2c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flair/models/text_regression_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def forward_loss(self, sentences: List[Sentence]) -> Tuple[torch.Tensor, int]:

def _labels_to_tensor(self, sentences: List[Sentence]):
indices = [
torch.tensor([float(label.value) for label in sentence.labels], dtype=torch.float) for sentence in sentences
torch.tensor([float(label.value) for label in sentence.get_labels(self.label_name)], dtype=torch.float)
for sentence in sentences
]

vec = torch.cat(indices, 0).to(flair.device)
Expand Down

0 comments on commit 355e2c0

Please sign in to comment.