Skip to content

Commit

Permalink
fix _prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneBinder committed Nov 13, 2024
1 parent 1932b18 commit e9acb06
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/pie_modules/taskmodules/pointer_network_for_end2end_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,13 @@ def _prepare(self, documents: Sequence[DocumentType]) -> None:

if self.add_reversed_relations:
for rel_label in set(labels[self.relation_layer_name]):
reversed_label = rel_label
if rel_label not in self.symmetric_relations:
reversed_label += self.REVERSED_RELATION_LABEL_SUFFIX
if reversed_label in labels[self.relation_layer_name]:
raise ValueError(
f"reversed relation label {reversed_label} already exists in relation layer labels"
)
labels[self.relation_layer_name].add(reversed_label)
reversed_label = rel_label + self.REVERSED_RELATION_LABEL_SUFFIX
if reversed_label in labels[self.relation_layer_name]:
raise ValueError(
f"reversed relation label {reversed_label} already exists in relation layer labels"
)
labels[self.relation_layer_name].add(reversed_label)

self.labels_per_layer = {
# sort labels to ensure deterministic order
Expand Down

0 comments on commit e9acb06

Please sign in to comment.