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

stft: Change require_complex warning to an error #49022

Closed
wants to merge 6 commits into from

Conversation

peterbell10
Copy link
Collaborator

@peterbell10 peterbell10 commented Dec 8, 2020

BC-breaking note:

Previously torch.stft took an optional return_complex parameter that indicated whether the output would be a floating point tensor or a complex tensor. By default return_complex was False to be consistent with the previous behavior of torch.stft. This PR changes this behavior so return_complex is a required argument.

PR Summary:

Stack from ghstack:

Differential Revision: D25658906

@dr-ci
Copy link

dr-ci bot commented Dec 8, 2020

💊 CI failures summary and remediations

As of commit a643614 (more details on the Dr. CI page):



🕵️ 1 new failure recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build pytorch_libtorch_linux_xenial_cuda11_1_cudnn8_py3_gcc7_build (1/1)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

Dec 15 16:51:08 sccache: error: couldn't connect to server
Dec 15 16:51:08 +++ eval 'extract_trap_cmd ' 
Dec 15 16:51:08 ++++ extract_trap_cmd 
Dec 15 16:51:08 ++++ printf '%s\n' '' 
Dec 15 16:51:08 +++ printf '%s\n' cleanup 
Dec 15 16:51:08 ++ trap -- ' 
Dec 15 16:51:08 cleanup' EXIT 
Dec 15 16:51:08 ++ [[ pytorch-libtorch-linux-xenial-cuda11.1-cudnn8-py3-gcc7-build != *pytorch-win-* ]] 
Dec 15 16:51:08 ++ which sccache 
Dec 15 16:51:08 ++ sccache --stop-server 
Dec 15 16:51:08 Stopping sccache server... 
Dec 15 16:51:08 sccache: error: couldn't connect to server 
Dec 15 16:51:08 sccache: caused by: Connection refused (os error 111) 
Dec 15 16:51:08 ++ true 
Dec 15 16:51:08 ++ rm /var/lib/jenkins/sccache_error.log 
Dec 15 16:51:08 rm: cannot remove '/var/lib/jenkins/sccache_error.log': No such file or directory 
Dec 15 16:51:08 ++ true 
Dec 15 16:51:08 ++ [[ pytorch-libtorch-linux-xenial-cuda11.1-cudnn8-py3-gcc7-build == *rocm* ]] 
Dec 15 16:51:08 ++ SCCACHE_ERROR_LOG=/var/lib/jenkins/sccache_error.log 
Dec 15 16:51:08 ++ SCCACHE_IDLE_TIMEOUT=1200 
Dec 15 16:51:08 ++ RUST_LOG=sccache::server=error 
Dec 15 16:51:08 ++ sccache --start-server 

❄️ 1 failure tentatively classified as flaky

but reruns have not yet been triggered to confirm:

See CircleCI build pytorch_xla_linux_bionic_py3_6_clang9_test (1/1)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun) ❄️

Dec 15 18:04:56 RuntimeError: tensorflow/compiler/xla/xla_client/xrt_local_service.cc:56 : Check failed: tensorflow::NewServer(server_def, &server_) == ::tensorflow::Status::OK() (Unknown: Could not start gRPC server vs. OK)
Dec 15 18:04:56   File "/opt/conda/lib/python3.6/site-packages/torch_xla-1.6-py3.6-linux-x86_64.egg/torch_xla/distributed/xla_multiprocessing.py", line 314, in _setup_replication 
Dec 15 18:04:56     device = xm.xla_device() 
Dec 15 18:04:56   File "/opt/conda/lib/python3.6/site-packages/torch_xla-1.6-py3.6-linux-x86_64.egg/torch_xla/core/xla_model.py", line 231, in xla_device 
Dec 15 18:04:56     devkind=devkind if devkind is not None else None) 
Dec 15 18:04:56   File "/opt/conda/lib/python3.6/site-packages/torch_xla-1.6-py3.6-linux-x86_64.egg/torch_xla/core/xla_model.py", line 136, in get_xla_supported_devices 
Dec 15 18:04:56     xla_devices = _DEVICES.value 
Dec 15 18:04:56   File "/opt/conda/lib/python3.6/site-packages/torch_xla-1.6-py3.6-linux-x86_64.egg/torch_xla/utils/utils.py", line 32, in value 
Dec 15 18:04:56     self._value = self._gen_fn() 
Dec 15 18:04:56   File "/opt/conda/lib/python3.6/site-packages/torch_xla-1.6-py3.6-linux-x86_64.egg/torch_xla/core/xla_model.py", line 18, in <lambda> 
Dec 15 18:04:56     _DEVICES = xu.LazyProperty(lambda: torch_xla._XLAC._xla_get_devices()) 
Dec 15 18:04:56 RuntimeError: tensorflow/compiler/xla/xla_client/xrt_local_service.cc:56 : Check failed: tensorflow::NewServer(server_def, &server_) == ::tensorflow::Status::OK() (Unknown: Could not start gRPC server vs. OK) 
Dec 15 18:04:57 Traceback (most recent call last): 
Dec 15 18:04:57   File "/var/lib/jenkins/workspace/xla/test/test_mp_all_gather.py", line 28, in <module> 
Dec 15 18:04:57     xmp.spawn(_mp_fn, args=()) 
Dec 15 18:04:57   File "/opt/conda/lib/python3.6/site-packages/torch_xla-1.6-py3.6-linux-x86_64.egg/torch_xla/distributed/xla_multiprocessing.py", line 394, in spawn 
Dec 15 18:04:57     start_method=start_method) 
Dec 15 18:04:57   File "/opt/conda/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 205, in start_processes 
Dec 15 18:04:57     while not context.join(): 
Dec 15 18:04:57   File "/opt/conda/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 160, in join 
Dec 15 18:04:57     exit_code=exitcode 
Dec 15 18:04:57 torch.multiprocessing.spawn.ProcessExitedException: process 3 terminated with exit code 17 

ci.pytorch.org: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 18 times.

}
TORCH_CHECK(
return_complexOpt.has_value() || return_complex,
"stft requires the return_complex parameter be explicitly "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good. Do you think we should also take this opportunity to deprecate return_complex=False?

Setting :attr:`return_complex` explicitly will be required in a future
PyTorch release. Set it to False to preserve the current behavior or
True to return a complex output.
From version 1.8.0, :attr:`return_complex` must be given explicitly for
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning seems great. Same question about whether we should deprecate return_complex=False now, too?

Seems like we should? I don't think we intend to support float tensors as surrogates for complex tensors long term.

peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Dec 15, 2020
ghstack-source-id: 0c3cabe6a4bbd883273aa888e0bdb94a1687e1bc
Pull Request resolved: pytorch#49022
@peterbell10
Copy link
Collaborator Author

@mruberry I've rebased on viable/strict, deprecated return_complex=False and reworded the error message and doc warnings to point the user directly to return_complex=True.

Test failures look unrelated.

"(which will be required in a future pytorch release). "
);

TORCH_WARN_ONCE(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning needs to be gated on the value actually being false, though. We don't want people who set return_complex=True to see it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait... I understand how this will work now. OK. That's cool.

So the conditional only triggers if return_complex is unspecified or False and it needs to be specified. Then the check will capture the case where it's unspecified. If the check is hit this function will stop (since it threw an exception). If not, then the value is specified but it's False, so the warning is thrown.

Cool.

Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@facebook-github-bot
Copy link
Contributor

@mruberry merged this pull request in 5874925.

@mruberry mruberry added module: bc-breaking Related to a BC-breaking change module: deprecation labels Dec 17, 2020
@mruberry mruberry reopened this Dec 17, 2020
@mruberry
Copy link
Collaborator

Hey @peterbell10, my mistake on landing this a little too swiftly. It looks like torchaudio has yet to update their stft calls. Let me ping them to do that before we land this so we don't break people using them.

@mruberry
Copy link
Collaborator

Torchaudio issue: pytorch/audio#1095

@facebook-github-bot facebook-github-bot deleted the gh/peterbell10/34/head branch December 24, 2020 15:21
hwangdeyu pushed a commit to hwangdeyu/pytorch that referenced this pull request Jan 6, 2021
Summary: Pull Request resolved: pytorch#49022

Test Plan: Imported from OSS

Reviewed By: ngimel

Differential Revision: D25569586

Pulled By: mruberry

fbshipit-source-id: 09608088f540c2c3fc70465f6a23f2aec5f24f85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants