Spaces:
Runtime error
Runtime error
File size: 811 Bytes
8044721 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/usr/bin/env python3
# coding=utf-8
import torch
from model.head.abstract_head import AbstractHead
from data.parser.to_mrp.node_centric_parser import NodeCentricParser
from utility.cross_entropy import binary_cross_entropy
class NodeCentricHead(AbstractHead):
def __init__(self, dataset, args, initialize):
config = {
"label": True,
"edge presence": True,
"edge label": False,
"anchor": True,
"source_anchor": False,
"target_anchor": False
}
super(NodeCentricHead, self).__init__(dataset, args, config, initialize)
self.source_id = dataset.label_field.vocab.stoi["Source"] + 1
self.target_id = dataset.label_field.vocab.stoi["Target"] + 1
self.parser = NodeCentricParser(dataset)
|