lucidrains / performer-pytorch

An implementation of Performer, a linear attention-based transformer, in Pytorch
MIT License
1.07k stars 143 forks source link

Fix torch.qr deprecation warning #75

Closed Erotemic closed 2 years ago

Erotemic commented 2 years ago

When training with a performer I get the following warning:

torch.qr is deprecated in favor of torch.linalg.qr and will be removed in a future PyTorch release.
The boolean parameter 'some' has been replaced with a string parameter 'mode'.
Q, R = torch.qr(A, some)
should be replaced with
Q, R = torch.linalg.qr(A, 'reduced' if some else 'complete') (Triggered internally at  /pytorch/aten/src/ATen/native/BatchLinearAlgebra.cpp:1940.)

This patch fixes it by conditionally switching to the new invocation, while maintaining backwards compatibility.

lucidrains commented 2 years ago

@Erotemic Thank you Jon!