question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RuntimeError when runnning inference

See original GitHub issue

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!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
RJ722commented, Oct 1, 2019

Thanks for fixing this @SeanNaren! \o/

Just a minor issue - the URL for the new release is broken (no dot after v).

Here’s the correct one - https://github.com/SeanNaren/deepspeech.pytorch/releases/tag/v2.0

1reaction
SeanNarencommented, Sep 30, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Model trains but I'm getting a RuntimeError during Inference
I am using Learner on a custom model. The model training works with learner.fit_one_cycle() but when I try to predict an output from...
Read more >
Trying to run inference with custom model but get Runtime ...
I am loading the model in with: gtf = torch.load(model_dir, map_location=torch.device(“cpu”)) But I get a Runtime Error saying: Runti…
Read more >
CUDA error while running bloom-accelerate-inference.py ...
Hello All,. Has anyone faced this issue, while running the bloom accelerate inference script? Is there a prescribed CUDA driver/python/torch ...
Read more >
Troubleshooting machine learning inference
You might see the following errors when you run machine learning inference on a Raspberry Pi running Raspberry Pi OS Bullseye. RuntimeError: module...
Read more >
OpenVINO YOLOv4 inference device didn't appear after ...
This issue (running YOLOv4 model with Object Detection Python Demo on MYRIAD device) is a known bug in OpenVINO 2021.4.752.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found