def __init__(self, net, idim, hdim, K, n_layers, dropout, lamb): super(Model, self).__init__() self.net = eval(net)(idim, hdim, n_layers, dropout=dropout) if net in ['BLSTM', 'BLSTMN', 'VGGBLSTM']: self.linear = nn.Linear(hdim * 2, K) else: self.linear = nn.Linear(hdim, K) self.loss_fn = CTC_CRF_LOSS(lamb=lamb)
def __init__(self, idim, hdim, K, dropout, lamb, reg_weight, use_ctc_crf=False): super(CAT_Chunk_Model, self).__init__() self.net = ChunkBLSTM_with_Context(idim, hdim, context=10, dropout=0.5) self.linear = nn.Linear(hdim*2, K) self.reg_weight = reg_weight self.criterion = nn.MSELoss(size_average=False) if use_ctc_crf: self.loss_fn = CTC_CRF_LOSS(lamb=lamb) else: self.loss_fn = WARP_CTC_LOSS()
def __init__(self, net, idim, hdim, K, n_layers, dropout, lamb, use_ctc_crf=False): super(CAT_Model, self).__init__() self.net = eval(net)(idim, hdim, n_layers, dropout=dropout) if net in ['BLSTM', 'BLSTMN']: self.linear = nn.Linear(hdim * 2, K) else: self.linear = nn.Linear(hdim, K) if use_ctc_crf: self.loss_fn = CTC_CRF_LOSS(lamb=lamb) else: self.loss_fn = WARP_CTC_LOSS()
def __init__(self, idim, hdim, K, n_layers, dropout, lamb): super(Model, self).__init__() self.net = BLSTM(idim, hdim, n_layers, dropout=dropout) self.linear = nn.Linear(hdim * 2, K) self.loss_fn = CTC_CRF_LOSS(lamb=lamb)