kjunelee / MetaOptNet

Meta-Learning with Differentiable Convex Optimization (CVPR 2019 Oral)
Apache License 2.0
529 stars 97 forks source link

qpth error #20

Closed zstbackcourt closed 5 years ago

zstbackcourt commented 5 years ago

when I run the code using " python train.py --gpu 0 --save-path "./experiments/CIFAR_FS_MetaOptNet_RR" --train-shot 5 --head Ridge --network ResNet --dataset CIFAR_FS ",I met the error

RuntimeError: qpth Error: Cannot perform LU factorization on Q. Please make sure that your Q matrix is PSD and has a non-zero diagonal.

How can I solve this error?

kjunelee commented 5 years ago

I haven't experience such issue on the ridge regression head, but the following should help.

After line 102 which says block_kernel_matrix = kernel_matrix.repeat(n_way, 1, 1) #(n_way * tasks_per_batch, n_support, n_support) append block_kernel_matrix += 1.0 * torch.eye(n_support).expand(n_way * tasks_per_batch, n_support, n_support).cuda()

Let me know if this helps.

LYF14020510036 commented 5 years ago

Hello, this problem can't be solved.

kjunelee commented 5 years ago

I think upgrading PyTorch to version 1.0 can solve the problem as mentioned in https://github.com/locuslab/qpth/issues/28

lucastononrodrigues commented 4 years ago

block_kernel_matrix += 1.0 torch.eye(n_support).expand(n_way tasks_per_batch, n_support, n_support).cuda()

I cannot find such line in the code, would you help me please? In what .py is it?

I'm having the same error

kjunelee commented 4 years ago

Please refer to https://github.com/kjunelee/MetaOptNet/blob/master/models/classification_heads.py

vardhanaleti commented 2 years ago

Even with the pytorch version 1.0, it gives the same error. Have you resolved it?