Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Output Layer
Browse files Browse the repository at this point in the history
Summary:
Enabling Multi Label output layer.

This is done by migrating domain classifier into a multi label.

Reviewed By: shreydesai

Differential Revision: D25440015

fbshipit-source-id: ca917d723a1cd06618e6592bdc122f132a5a071d
  • Loading branch information
Michael Marlen authored and facebook-github-bot committed Dec 15, 2020
1 parent 5068b68 commit bd270fa
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
KLDivergenceCELoss,
LabelSmoothedCrossEntropyLoss,
MultiLabelSoftMarginLoss,
BinaryCrossEntropyWithLogitsLoss,
)
from pytext.utils.label import get_label_weights
from torch import jit
Expand All @@ -43,6 +44,7 @@ class Config(OutputLayerBase.Config):
loss: Union[
CrossEntropyLoss.Config,
BinaryCrossEntropyLoss.Config,
BinaryCrossEntropyWithLogitsLoss.Config,
MultiLabelSoftMarginLoss.Config,
AUCPRHingeLoss.Config,
KLDivergenceBCELoss.Config,
Expand Down Expand Up @@ -83,6 +85,8 @@ def from_config(
cls = BinaryClassificationOutputLayer
elif isinstance(loss, MultiLabelSoftMarginLoss):
cls = MultiLabelOutputLayer
elif isinstance(loss, BinaryCrossEntropyWithLogitsLoss):
cls = MultiLabelOutputLayer
else:
cls = MulticlassOutputLayer

Expand Down

0 comments on commit bd270fa

Please sign in to comment.