Skip to content

RuntimeError when runnning inference #426

@RJ722

Description

@RJ722

Hi,

I've installed everything which is mentioned in the README and have downloaded an4 dataset using the script. Also, I've downloaded the pre-trained models from the GitHub releases, and checked out commit 655cd58 (otherwise the model is incompatible).

Now, when I run:

 python test.py --model-path models/an4_pretrained.pth --test-manifest data/an4_val_manifest.csv --cuda

I'm getting the following error:

Traceback (most recent call last):
  File "/root/anaconda3/envs/deepspeech_2/lib/python3.6/site-packages/torch/jit/annotations.py", line 95, in parse_type_line
    arg_ann = eval(arg_ann_str, _eval_env)
  File "<string>", line 1, in <module>
NameError: name 'Optional' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 7, in <module>
    from data.data_loader import SpectrogramDataset, AudioDataLoader
  File "/root/deepspeech.pytorch/data/__init__.py", line 1, in <module>
    from . import data_loader
  File "/root/deepspeech.pytorch/data/data_loader.py", line 13, in <module>
    import torchaudio
  File "/root/anaconda3/envs/deepspeech_2/lib/python3.6/site-packages/torchaudio-0.2-py3.6-linux-x86_64.egg/torchaudio/__init__.py", line 7, in <module>
    from torchaudio import transforms, datasets, kaldi_io, sox_effects, legacy
  File "/root/anaconda3/envs/deepspeech_2/lib/python3.6/site-packages/torchaudio-0.2-py3.6-linux-x86_64.egg/torchaudio/transforms.py", line 6, in <module>
    from . import functional as F
  File "/root/anaconda3/envs/deepspeech_2/lib/python3.6/site-packages/torchaudio-0.2-py3.6-linux-x86_64.egg/torchaudio/functional.py", line 108, in <module>
    @torch.jit.script
  File "/root/anaconda3/envs/deepspeech_2/lib/python3.6/site-packages/torch/jit/__init__.py", line 824, in script
    fn = torch._C._jit_script_compile(ast, _rcb, get_default_args(obj))
  File "/root/anaconda3/envs/deepspeech_2/lib/python3.6/site-packages/torch/jit/annotations.py", line 55, in get_signature
    return parse_type_line(type_line)
  File "/root/anaconda3/envs/deepspeech_2/lib/python3.6/site-packages/torch/jit/annotations.py", line 97, in parse_type_line
    raise RuntimeError("Failed to parse the argument list of a type annotation: {}".format(str(e)))
RuntimeError: Failed to parse the argument list of a type annotation: name 'Optional' is not defined

I'm not quite sure how to debug this. I shall be grateful for any help, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions