Download model/head/sequential_head.py from ltg/ssa-perin: direct link, hf CLI and curl.
- Browser
- Download file 710 Bytes
-
https://huggingface.co/ltg/ssa-perin/resolve/main/model/head/sequential_head.py
- Command line
-
hf download hf://ltg/ssa-perin/model/head/sequential_head.py
-
curl -L -o sequential_head.py https://huggingface.co/ltg/ssa-perin/resolve/main/model/head/sequential_head.py
710 Bytes
| #!/usr/bin/env python3 | |
| # coding=utf-8 | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| from model.head.abstract_head import AbstractHead | |
| from data.parser.to_mrp.sequential_parser import SequentialParser | |
| from utility.cross_entropy import cross_entropy | |
| class SequentialHead(AbstractHead): | |
| def __init__(self, dataset, args, initialize): | |
| config = { | |
| "label": True, | |
| "edge presence": False, | |
| "edge label": False, | |
| "anchor": True, | |
| "source_anchor": True, | |
| "target_anchor": True | |
| } | |
| super(SequentialHead, self).__init__(dataset, args, config, initialize) | |
| self.parser = SequentialParser(dataset) | |