Exemple #1
0
 def add_arguments(parser):
     """Add arguments."""
     return E2E_pytorch.add_arguments(parser)
Exemple #2
0
 def add_arguments(parser):
     return E2E_pytorch.add_arguments(parser)
Exemple #3
0
assert len(devset[0]) == batch_size
devset[0][:3]

"""### Build neural networks (3/4)

For simplicity, we use a predefined model: [Transformer](https://papers.nips.cc/paper/7181-attention-is-all-you-need.pdf). 

NOTE: You can also use your custom model in command line tools as `asr_train.py --model-module your_module:YourModel`
"""

import argparse
from espnet.bin.asr_train import get_parser
from espnet.nets.pytorch_backend.e2e_asr import E2E

parser = get_parser()
parser = E2E.add_arguments(parser)
config = parser.parse_args([
    "--mtlalpha", "0.0",  # weight for cross entropy and CTC loss
    "--outdir", "out", "--dict", ""])  # TODO: allow no arg

idim = info["input"][0]["shape"][1]
odim = info["output"][0]["shape"][1]
setattr(config, "char_list", [])
model = E2E(idim, odim, config)
model

"""### Update neural networks by iterating datasets (4/4)

Finaly, we got the training part.
"""