Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recommended install method does not work #8

Closed
hamilyon opened this issue Jul 16, 2019 · 3 comments
Closed

recommended install method does not work #8

hamilyon opened this issue Jul 16, 2019 · 3 comments

Comments

@hamilyon
Copy link

Cloning into 'torchaudio'...
remote: Enumerating objects: 87, done.
remote: Counting objects: 100% (87/87), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 1080 (delta 47), reused 47 (delta 23), pack-reused 993
Receiving objects: 100% (1080/1080), 6.13 MiB | 5.73 MiB/s, done.
Resolving deltas: 100% (442/442), done.
running install
running bdist_egg
running egg_info
creating torchaudio.egg-info
writing torchaudio.egg-info/PKG-INFO
writing dependency_links to torchaudio.egg-info/dependency_links.txt
writing requirements to torchaudio.egg-info/requires.txt
writing top-level names to torchaudio.egg-info/top_level.txt
writing manifest file 'torchaudio.egg-info/SOURCES.txt'
reading manifest file 'torchaudio.egg-info/SOURCES.txt'
writing manifest file 'torchaudio.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/torchaudio
copying torchaudio/transforms.py -> build/lib.linux-x86_64-3.7/torchaudio
copying torchaudio/common_utils.py -> build/lib.linux-x86_64-3.7/torchaudio
copying torchaudio/functional.py -> build/lib.linux-x86_64-3.7/torchaudio
copying torchaudio/sox_effects.py -> build/lib.linux-x86_64-3.7/torchaudio
copying torchaudio/legacy.py -> build/lib.linux-x86_64-3.7/torchaudio
copying torchaudio/kaldi_io.py -> build/lib.linux-x86_64-3.7/torchaudio
copying torchaudio/__init__.py -> build/lib.linux-x86_64-3.7/torchaudio
creating build/lib.linux-x86_64-3.7/test
copying test/common_utils.py -> build/lib.linux-x86_64-3.7/test
copying test/test_jit.py -> build/lib.linux-x86_64-3.7/test
copying test/test_functional.py -> build/lib.linux-x86_64-3.7/test
copying test/test_kaldi_io.py -> build/lib.linux-x86_64-3.7/test
copying test/test_sox_effects.py -> build/lib.linux-x86_64-3.7/test
copying test/__init__.py -> build/lib.linux-x86_64-3.7/test
copying test/test.py -> build/lib.linux-x86_64-3.7/test
copying test/test_transforms.py -> build/lib.linux-x86_64-3.7/test
copying test/test_dataloader.py -> build/lib.linux-x86_64-3.7/test
copying test/test_legacy.py -> build/lib.linux-x86_64-3.7/test
creating build/lib.linux-x86_64-3.7/torchaudio/datasets
copying torchaudio/datasets/yesno.py -> build/lib.linux-x86_64-3.7/torchaudio/datasets
copying torchaudio/datasets/vctk.py -> build/lib.linux-x86_64-3.7/torchaudio/datasets
copying torchaudio/datasets/__init__.py -> build/lib.linux-x86_64-3.7/torchaudio/datasets
creating build/lib.linux-x86_64-3.7/torchaudio/compliance
copying torchaudio/compliance/kaldi.py -> build/lib.linux-x86_64-3.7/torchaudio/compliance
copying torchaudio/compliance/__init__.py -> build/lib.linux-x86_64-3.7/torchaudio/compliance
running build_ext
building '_torch_sox' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/torchaudio
torchaudio/torch_sox.cpp:1:29: fatal error: torch/extension.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
@zcaceres
Copy link
Owner

Looks like torchaudio has changed something internally so the cloned torchaudio repo doesn't work. PRs welcome, otherwise I may be able to fix it sometime this week.

@expectopatronum
Copy link

I assume that previously it was necessary to git clone torchaudio in order to install it. Since a couple of days it is possible to install it with pip or conda (source). For me it works that way.

I had to change a few things in the notebook to make it work (they changed some parameter names & mel.permute is not necessary anymore):

def tfm_spectro(ad:Audio, sr=16000, to_db_scale=False, n_fft=1024, 
                ws=None, hop=None, f_min=0.0, f_max=-80, pad=0, n_mels=128):
    # We must reshape signal for torchaudio to generate the spectrogram.
    mel = transforms.MelSpectrogram(sample_rate=ad.sr, n_mels=n_mels, n_fft=n_fft, win_length=ws, hop_length=hop, 
                                    f_min=f_min, f_max=f_max, pad=pad,)(ad.sig.reshape(1, -1))
    # mel = mel.permute(0,2,1) # swap dimension, mostly to look sane to a human.
    if to_db_scale: mel = transforms.AmplitudeToDB(stype='magnitude', top_db=f_max)(mel)
    return mel

@zcaceres
Copy link
Owner

Thank you @expectopatronum . Would you be willing to make a PR with these fixes? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants