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.

speechbrain foreign_class AttributeError

See original GitHub issue

Hello,

I’m trying to run the following code:

from speechbrain.pretrained.interfaces import foreign_class

classifier = foreign_class(source="speechbrain/emotion-recognition-wav2vec2-IEMOCAP", pymodule_file="custom_interface.py", classname="CustomEncoderWav2vec2Classifier")

And I get the following error:

emotion_detection.py 8 <module> classifier = foreign_class(source=“speechbrain/emotion-recognition-wav2vec2-IEMOCAP”,

interfaces.py 97 foreign_class hparams = load_hyperpyyaml(fin, overrides)

core.py 189 load_hyperpyyaml removal_keys = [k for k in hparams.keys() if k.startswith(“__”)]

AttributeError: ‘str’ object has no attribute ‘keys’

AttributeError: 'str' object has no attribute 'keys'

I tried all possible ways to try to solve this issue. I even re-installed python 3.9 and all the dependencies. I tried to install speechbrain via pip and github, and the installation process did not throw any exceptions. However, I just cannot get the code to run.

I was able to get it run on another computer and I did exactly what I did here. I don’t understand what happened … can anyone give me a hint?

Thank you so much!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
Adel-Moumencommented, Sep 6, 2022

Hello @lindagaw,

It’s good news that you successfully solved the issue!

No worries 😃

1reaction
lindagawcommented, Sep 6, 2022

Hello Adel-Moumen,

I got the module running by deleting the wav2vec2_checkpoints and pretrained_models folders.

Thank you for your help and I’m so sorry for all the trouble!

Best, lindagaw

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · speechbrain/speechbrain - GitHub
During speaker_id inference, running into an OSError: [WinError 1921] The name of the file cannot be resolved by the system: ...
Read more >
speechbrain.pretrained.interfaces module - Read the Docs
The class can be used either to run only the encoder (encode()) to extract features or to run the entire model (decode()) to...
Read more >
SpeechBrain: A PyTorch Speech Toolkit
SpeechBrain is an open-source conversational AI toolkit. We designed it to be simple, flexible, and well-documented. It achieves competitive performance in ...
Read more >
speechbrain - PyPI
SpeechBrain is an open-source and all-in-one conversational AI toolkit based on PyTorch. The goal is to create a single, flexible, and user-friendly toolkit ......
Read more >
How to Run Speech Recognition Recipe using SpeechBrain
SpeechBrain is an open-source and all-in-one conversational AI toolkit. It is designed to be simple, extremely flexible, and user-friendly.
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