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.

No module named 'torch.tensor'

See original GitHub issue

Hi, I wrote the correct code a few weeks ago and run on Colab, it works well. Now I want to reuse the code. Right now the basic code could not running, is it a PyTorch upgrade or something else

import torch print(torch.hub.list('s3prl/s3prl')) print(torch.hub.load('s3prl/s3prl', 'audio_albert'))

the error is

` [hubconf] can not import upstream.wav2vec2_hug.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.roberta.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.apc.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.spec_augment.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.hubert.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.wav2vec.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.vq_apc.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.mockingjay.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.example.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.tera.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.vq_wav2vec.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.npc.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.audio_albert.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.baseline.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.pase.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.wav2vec2.hubconf: No module named ‘torch.tensor’… Pass. [hubconf] can not import upstream.cpc.hubconf: No module named ‘torch.tensor’… Pass. Using cache found in /root/.cache/torch/hub/s3prl_s3prl_master

RuntimeError Traceback (most recent call last) <ipython-input-6-ba07a714d0f8> in <module>() ----> 1 print(torch.hub.load(‘s3prl/s3prl’, ‘audio_albert’))

2 frames /usr/local/lib/python3.7/dist-packages/torch/hub.py in load(repo_or_dir, model, *args, **kwargs) 362 repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose) 363 –> 364 model = _load_local(repo_or_dir, model, *args, **kwargs) 365 return model 366

/usr/local/lib/python3.7/dist-packages/torch/hub.py in _load_local(hubconf_dir, model, *args, **kwargs) 390 hub_module = import_module(MODULE_HUBCONF, hubconf_path) 391 –> 392 entry = _load_entry_from_hubconf(hub_module, model) 393 model = entry(*args, **kwargs) 394

/usr/local/lib/python3.7/dist-packages/torch/hub.py in _load_entry_from_hubconf(m, model) 210 211 if func is None or not callable(func): –> 212 raise RuntimeError(‘Cannot find callable {} in hubconf’.format(model)) 213 214 return func

RuntimeError: Cannot find callable audio_albert in hubconf `

thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
myhrbeucommented, Jun 30, 2021

Hi, When I saw that the middle three layers had the same value and the dictionary key was named “hidden_state_XX”, I thought this was the weight for the middle layer.

I recommend that writing a document or a demo tells us what the values mean of each key is and how to calculate it, and so far I’ve only found a brief introduction in the introduction. It would be better if you could also let me know how the list features of the previous version were calculated by this version. I lost 2 points of accuracy for the features of the two versions, which was about 4 points higher than that of SOTA before, but now it is 2% higher.

The idea of the features of middle layers contains in a dict that can be used by the users is great! Thank you and the team for the work!

Thanks!

0reactions
leo19941227commented, Jul 4, 2021

Hey!

This issue is resolved in the latest master. Thanks for your patient!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No module named 'torch.tensor'" - Stack Overflow
In line 4, change this from torch.tensor import Tensor. TO from torch import Tensor.
Read more >
Python ModuleNotFoundError: No Module Named 'torch'
Solution Idea 1: Install Library torch ... The most likely reason is that Python doesn't provide torch in its standard library. You need...
Read more >
ModuleNotFoundError: No module named 'torch' #4827 - GitHub
I installed pytorch but when i try to run it on any ide or text editor i get the "no module named torch"....
Read more >
No module named 'torch' ( Ubuntu 18.04, python 3 )
How to fix error: ModuleNotFoundError: No module named 'torch'
Read more >
Modulenotfounderror: No module named 'torch' (Fix the error)
Modulenotfounderror: No module named 'torch' error occurs when pytorch python module is either not found or its path is not set.
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