Skip to content

Commit

Permalink
Merge branch 'master' into gh-3487/fix-gpu-memory-leak-text-pair-regr…
Browse files Browse the repository at this point in the history
…essor
  • Loading branch information
alanakbik committed Jul 8, 2024
2 parents d0842db + 355e2c0 commit 27c0638
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 27c0638

Please sign in to comment.