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.

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

See original GitHub issue

While running pretrained models tutorial (https://colab.research.google.com/drive/1LN7R3U3xneDgDRK2gC5MzGkLysCWxuC3?usp=sharing) on Google colab I’ve encountered the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-21-4ab510a1a511> in <module>()
----> 1 asr_model.modules.keys()

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

This occurs after following lines:

from speechbrain.pretrained import EncoderDecoderASR
asr_model = EncoderDecoderASR.from_hparams(source="speechbrain/asr-crdnn-rnnlm-librispeech", savedir="./pretrained_ASR")
asr_model.modules.keys()

Any ideas why it happens?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
Gastroncommented, Jan 4, 2022

The argument was actually kept as modules, just the internal attribute name was changed. Could add a note in the docstring though-

1reaction
Gastroncommented, Jan 4, 2022

Ah, the notebook should be changed. We made the Pretrained interfaces into torch.nn.Modules, which have a .modules() method. We changed the old Pretrained.modules attribute to Pretrained.mods.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'function' object has no attribute 'keys'
You assign the function load_breast_cancer to the variable data , making the variable data refer to the function load_breast_cancer .
Read more >
AttributeError: 'list' object has no attribute 'keys' | bobbyhadz
The Python "AttributeError: 'list' object has no attribute 'keys'" occurs when we call the keys() method on a list instead of a dictionary....
Read more >
Dict' Object Has No Attribute 'Key' in Python | Codeigo
The Python error we are discussing here is of AttributeError class. AttributeError generally occurs because an attribute (function object of ...
Read more >
AttributeError: 'function' object has no attribute - Databricks
Using protected keywords from the DataFrame API as column names results in a function object has no attribute error message.
Read more >
AttributeError: 'list' object has no attribute 'keys' - Reddit
I don't understand why I'm getting this error. I thought the key attributes were 'p_0', 'p_1', 'p_2'.
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