median-research-group / LibMTL

A PyTorch Library for Multi-Task Learning
MIT License
1.98k stars 185 forks source link

It seems that some functions are not compatible with the latest pytorch #66

Closed 464hee closed 10 months ago

464hee commented 10 months ago

Traceback (most recent call last): File "/media/baize/0_code/mtl_main/main.py", line 112, in main(params) File "/media/baize/0_code/mtl_main/main.py", line 98, in main NYUmodel.train(nyuv2_train_loader, nyuv2_test_loader, params.epochs) File "/media/baize/0_code/mtl_main/LibMTL/trainer.py", line 230, in train w = self.model.backward(train_losses, **self.kwargs['weight_args']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/media/baize/0_code/mtl_main/LibMTL/weighting/Aligned_MTL.py", line 25, in backward lmbda, V = torch.symeig(M, eigenvectors=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/miniconda3/envs/py311tourch201/lib/python3.11/site-packages/torch/_linalg_utils.py", line 136, in _symeig raise RuntimeError( RuntimeError: This function was deprecated since version 1.9 and is now removed. The default behavior has changed from using the upper triangular portion of the matrix by default to using the lower triangular portion.

L, _ = torch.symeig(A, upper=upper) should be replaced with: L = torch.linalg.eigvalsh(A, UPLO='U' if upper else 'L')

and

L, V = torch.symeig(A, eigenvectors=True) should be replaced with: L, V = torch.linalg.eigh(A, UPLO='U' if upper else 'L')

Baijiong-Lin commented 10 months ago

We recommend to use torch1.8.1. https://github.com/median-research-group/LibMTL/blob/151a6747d5f7c9668fcd4709cfbedf98e3d5f898/requirements.txt#L11