File size: 1,474 Bytes
5d30583 |
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
from transformers import PretrainedConfig
class COMET19_CN_Config(PretrainedConfig):
def __init__(
self,
model: str = "transformer",
nL: int = 12,
nH: int = 12,
hSize: int = 768,
edpt: float = 0.1,
adpt: float = 0.1,
rdpt: float = 0.1,
odpt: float = 0.1,
pt: str = "gpt",
afn: str = "gelu",
init: str = "pt",
vSize: int = 40545,
n_ctx: int = 31,
n_vocab: int = 40545,
return_acts: bool = True,
return_probs: bool = False,
**kwargs,
):
self.model = model
self.nL = nL
self.nH = nH
self.hSize = hSize
self.edpt = edpt
self.adpt = adpt
self.rdpt = rdpt
self.odpt = odpt
self.pt = pt
self.afn = afn
self.init = init
self.vSize = vSize
self.n_ctx = n_ctx
self.n_vocab = n_vocab
self.return_acts = return_acts
self.return_probs = return_probs
super().__init__(**kwargs)
def parse_net_config(config):
return {
'model': config.model,
'nL': config.nL,
'nH': config.nH,
'hSize': config.hSize,
'edpt': config.edpt,
'adpt': config.adpt,
'rdpt': config.rdpt,
'odpt': config.odpt,
'pt': config.pt,
'afn': config.afn,
'init': config.init,
'vSize': config.vSize,
'n_ctx': config.n_ctx,
} |