Cannot import torchaudio

username: ygabuev
cooked: <p>I have an error when trying to import torchaudio:</p>
<pre><code class="lang-auto">&gt;&gt;&gt; import torchaudio
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
&lt;ipython-input-3-4cf0a64f61c0&gt; in &lt;module&gt;
----&gt; 1 import torchaudio

/opt/conda/lib/python3.6/site-packages/torchaudio-0.4.0a0+256458f-py3.6-linux-x86_64.egg/torchaudio/__init__.py in &lt;module&gt;
      5 import _torch_sox
      6 
----&gt; 7 from torchaudio import transforms, datasets, kaldi_io, sox_effects, compliance, _docs
      8 
      9 try:

/opt/conda/lib/python3.6/site-packages/torchaudio-0.4.0a0+256458f-py3.6-linux-x86_64.egg/torchaudio/transforms.py in &lt;module&gt;
      4 import torch
      5 from typing import Optional
----&gt; 6 from . import functional as F
      7 from .compliance import kaldi
      8 

/opt/conda/lib/python3.6/site-packages/torchaudio-0.4.0a0+256458f-py3.6-linux-x86_64.egg/torchaudio/functional.py in &lt;module&gt;
    637 
    638 @torch.jit.script
--&gt; 639 def highpass_biquad(waveform, sample_rate, cutoff_freq, Q=0.707):
    640     # type: (Tensor, int, float, float) -&gt; Tensor
    641     r"""Designs biquad highpass filter and performs filtering.  Similar to SoX implementation.

/opt/conda/lib/python3.6/site-packages/torch/jit/__init__.py in script(obj, optimize, _frames_up, _rcb)
   1209         if _rcb is None:
   1210             _rcb = _gen_rcb(obj, _frames_up)
-&gt; 1211         fn = torch._C._jit_script_compile(qualified_name, ast, _rcb, get_default_args(obj))
   1212         # Forward docstrings
   1213         fn.__doc__ = obj.__doc__

RuntimeError: 
Arguments for call are not valid.
The following operator variants are available:
  
  aten::div.out(Tensor self, Tensor other, *, Tensor(a!) out) -&gt; (Tensor(a!)):
  Expected a value of type 'Tensor' for argument 'self' but instead found type 'float'.
  
  aten::div.Tensor(Tensor self, Tensor other) -&gt; (Tensor):
  Expected a value of type 'Tensor' for argument 'self' but instead found type 'float'.
  
  aten::div.Scalar(Tensor self, Scalar other) -&gt; (Tensor):
  Expected a value of type 'Tensor' for argument 'self' but instead found type 'float'.
  
  aten::div(int a, int b) -&gt; (float):
  Expected a value of type 'int' for argument 'a' but instead found type 'float'.
  
  aten::div(float a, float b) -&gt; (float):
  Expected a value of type 'float' for argument 'b' but instead found type 'int'.
  
  div(float a, Tensor b) -&gt; (Tensor):
  Expected a value of type 'Tensor' for argument 'b' but instead found type 'int'.
  
  div(int a, Tensor b) -&gt; (Tensor):
  Expected a value of type 'int' for argument 'a' but instead found type 'float'.

The original call is:
at /opt/conda/lib/python3.6/site-packages/torchaudio-0.4.0a0+256458f-py3.6-linux-x86_64.egg/torchaudio/functional.py:654:9
        sample_rate (int): sampling rate of the waveform, e.g. 44100 (Hz)
        cutoff_freq (float): filter cutoff frequency
        Q (float): https://en.wikipedia.org/wiki/Q_factor

    Returns:
        output_waveform (torch.Tensor): Dimension of `(channel, time)`
    """

    GAIN = 1.
    w0 = 2 * math.pi * cutoff_freq / sample_rate
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &lt;--- HERE
    A = math.exp(GAIN / 40.0 * math.log(10))
    alpha = math.sin(w0) / 2. / Q
    mult = _dB2Linear(max(GAIN, 0))

    b0 = (1 + math.cos(w0)) / 2
    b1 = -1 - math.cos(w0)
    b2 = b0
    a0 = 1 + alpha
    a1 = -2 * math.cos(w0)
</code></pre>
<p>My setup: Ubuntu running from Docker, pytorch 1.3.0a0+24ae9b5, torchaudio 0.4.0a0+256458f</p>

username: vincentqb
cooked: <p>Since you are compiling from source, please make sure you have the latest version (of pytorch and torchaudio) from master. This may have been fixed by <a href="https://github.com/pytorch/audio/pull/326" rel="nofollow noopener">https://github.com/pytorch/audio/pull/326</a>.</p>
<p>Note to self: This should not be related to <a href="https://github.com/pytorch/audio/pull/339" rel="nofollow noopener">https://github.com/pytorch/audio/pull/339</a>.</p>

username: ygabuev
cooked: <p>I thought I had the latest versions, but I didn’t. Thank you!</p>