Пример #1
0
def prepare(args):
    idim = 10
    odim = len(args.char_list)
    model = E2E(idim, odim, args)
    batchsize = 2

    x = torch.randn(batchsize, 15, idim)
    ilens = [15, 10]
    n_token = odim - 2  # w/o <eos>/<sos>, <mask>
    y = (torch.rand(batchsize, 10) * n_token % n_token).long()
    olens = [7, 6]
    for i in range(batchsize):
        x[i, ilens[i]:] = -1
        y[i, olens[i]:] = model.ignore_id

    data = []
    for i in range(batchsize):
        data.append((
            "utt%d" % i,
            {
                "input": [{
                    "shape": [ilens[i], idim]
                }],
                "output": [{
                    "shape": [olens[i]]
                }],
            },
        ))

    return model, x, torch.tensor(ilens), y, data
Пример #2
0
 def add_arguments(parser):
     """Add arguments."""
     E2ETransformer.add_arguments(parser)
     E2E.add_conformer_arguments(parser)
     return parser
Пример #3
0
 def add_arguments(parser):
     """Add arguments."""
     E2EASR.add_arguments(parser)
     E2EASRMIX.encoder_mix_add_arguments(parser)
     return parser
Пример #4
0
    def add_arguments(parser):
        """Add arguments."""
        E2ETransformer.add_arguments(parser)
        E2E.add_maskctc_arguments(parser)

        return parser
 def add_arguments(parser):
     """Add arguments."""
     E2ETransformer.add_arguments(parser)
     E2E.add_hopfield_arguments(parser)
     return parser