Skip to content

Conversation

@vincentqb
Copy link
Contributor

@vincentqb vincentqb commented Apr 3, 2020

As noted here, tests were not running, when invoking through python test.py.

cc @mthrok

@vincentqb
Copy link
Contributor Author

vincentqb commented Apr 3, 2020

On GPU:

❯ python test_torchscript_consistency.py

Run test with cuda: True
................................E..........F.
======================================================================
ERROR: test_Fade (__main__.TestTransforms)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_torchscript_consistency.py", line 394, in test_Fade
    _test_script_module(torchaudio.transforms.Fade, waveform, fade_in_len, fade_out_len)
  File "test_torchscript_consistency.py", line 328, in _test_script_module
    py_out = py_method(tensor)
  File "/private/home/vincentqb/anaconda3/envs/audio-built/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/private/home/vincentqb/anaconda3/envs/audio-built/lib/python3.7/site-packages/torchaudio-0.5.0a0+4875007-py3.7-linux-x86_64.egg/torchaudio/transforms.py", line 727, in forward
    return self._fade_in(waveform_length) * self._fade_out(waveform_length) * waveform
RuntimeError: expected device cpu but got device cuda:0

======================================================================
FAIL: test_TimeStretch (__main__.TestTransforms)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_torchscript_consistency.py", line 385, in test_TimeStretch
    tensor, n_freq=n_freq, hop_length=hop_length, fixed_rate=fixed_rate)
  File "test_torchscript_consistency.py", line 331, in _test_script_module
    assert torch.allclose(jit_out, py_out)
AssertionError

----------------------------------------------------------------------
Ran 45 tests in 253.642s

FAILED (failures=1, errors=1)

@vincentqb
Copy link
Contributor Author

Self-approving PR.

@vincentqb vincentqb merged commit adef7b9 into pytorch:master Apr 3, 2020
@mthrok
Copy link
Contributor

mthrok commented Apr 4, 2020

FYI: The way tests are invoked is python -m pytest <script>, tests were running in CI as intended. unittest.main is only required when running test script directly with python, but that does not work with tests written in pytest (test_functional.py)

@vincentqb vincentqb deleted the unittestrun branch April 7, 2020 14:13
mthrok pushed a commit to mthrok/audio that referenced this pull request Feb 26, 2021
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

Successfully merging this pull request may close these issues.

2 participants