Skip to content

bert-crf #29

@Astudnew

Description

@Astudnew

Hello
in this part of your code in bertcrf class (forward fn), you write it is for pass the first token but i don't understand how this hanpped (and the len of seq_logist and seq_lables doed not change it the same length with sub tokens , CLS and SEP )

"for seq_logits, seq_labels, seq_mask in zip(logits, labels, mask):
# Index logits and labels using prediction mask to pass only the
# first subtoken of each word to CRF.
seq_logits = seq_logits[seq_mask].unsqueeze(0)
seq_labels = seq_labels[seq_mask].unsqueeze(0)
loss -= self.crf(seq_logits, seq_labels,
reduction='token_mean')"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions