Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

init target_formatter not only typed #1665

Merged
merged 4 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/flash/audio/classification/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def load_data(
# If we had binary multi-class targets then we also know the labels (column names)
if (
self.training
and hasattr(self, "target_formatter")
and isinstance(self.target_formatter, MultiBinaryTargetFormatter)
and isinstance(target_keys, List)
):
Expand Down
1 change: 1 addition & 0 deletions src/flash/image/classification/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def load_data(
# If we had binary multi-class targets then we also know the labels (column names)
if (
self.training
and hasattr(self, "target_formatter")
and isinstance(self.target_formatter, MultiBinaryTargetFormatter)
and isinstance(target_keys, List)
):
Expand Down
6 changes: 5 additions & 1 deletion src/flash/text/classification/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@
self.load_target_metadata(targets, target_formatter=target_formatter)

# If we had binary multi-class targets then we also know the labels (column names)
if isinstance(self.target_formatter, MultiBinaryTargetFormatter) and isinstance(target_keys, List):
if (

Check warning on line 56 in src/flash/text/classification/input.py

View check run for this annotation

Codecov / codecov/patch

src/flash/text/classification/input.py#L56

Added line #L56 was not covered by tests
hasattr(self, "target_formatter")
and isinstance(self.target_formatter, MultiBinaryTargetFormatter)
and isinstance(target_keys, List)
):
self.labels = target_keys

# remove extra columns
Expand Down
2 changes: 2 additions & 0 deletions src/flash/video/classification/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def load_data(
# If we had binary multi-class targets then we also know the labels (column names)
if (
self.training
and hasattr(self, "target_formatter")
and isinstance(self.target_formatter, MultiBinaryTargetFormatter)
and isinstance(target_keys, List)
):
Expand Down Expand Up @@ -243,6 +244,7 @@ def load_data(
# If we had binary multi-class targets then we also know the labels (column names)
if (
self.training
and hasattr(self, "target_formatter")
and isinstance(self.target_formatter, MultiBinaryTargetFormatter)
and isinstance(targets, List)
):
Expand Down