Skip to content

Commit

Permalink
Fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
plonerma committed Jan 3, 2025
1 parent cab5105 commit 5ae1508
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion flair/nn/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ def __init__(
decay - after every batch,
multi_label: Whether to predict multiple labels per sentence (default is False, and performs multi-class clsasification).
"""

super().__init__()

self.label_dictionary = label_dictionary
Expand Down
6 changes: 3 additions & 3 deletions flair/nn/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from abc import ABC, abstractmethod
from collections import Counter
from pathlib import Path
from typing import Any, List, Optional, Tuple, Union
from typing import Any, Optional, Union

import torch.nn
from torch import Tensor
Expand Down Expand Up @@ -780,7 +780,7 @@ def forward_loss(self, sentences: list[DT]) -> tuple[torch.Tensor, int]:

# decode, passing label tensor if needed, such as for prototype updates
if "label_tensor" in inspect.signature(self.decoder.forward).parameters:
scores = self.decoder(data_point_tensor, label_tensor)
scores = self.decoder(data_point_tensor, label_tensor=label_tensor)
else:
scores = self.decoder(data_point_tensor)

Expand Down Expand Up @@ -817,7 +817,7 @@ def predict(
label_name: Optional[str] = None,
return_loss: bool = False,
embedding_storage_mode: EmbeddingStorageMode = "none",
) -> Optional[Union[List[DT], Tuple[float, int]]]:
) -> Optional[Union[list[DT], tuple[float, int]]]:
"""Predicts the class labels for the given sentences. The labels are directly added to the sentences.
Args:
Expand Down

0 comments on commit 5ae1508

Please sign in to comment.