noahgolmant / pytorch-hessian-eigenthings

Efficient PyTorch Hessian eigendecomposition tools!
MIT License
360 stars 43 forks source link

ValueError: PENet on the Kitti benchmark suite #41

Open AjinkyaBankar opened 3 years ago

AjinkyaBankar commented 3 years ago

Hello, I want to find the eigenvalues and eigenvectors for the PENet on the Kitti benchmark suite given here. I am using a pre-trained network with 'pe.pth.tar' files provided in the repo. I get the following error when I apply the compute_hessian_eigenthings(model, val_loader, depth_criterion, num_eigenthings=1, full_dataset=False, mode="power_iter", use_gpu=True, fp16=False,):

Traceback (most recent call last):

  File "/home/ajinkya/PyTorch_Codes_2/my_main.py", line 325, in <module>
    eigenvals, eigenvecs = compute_hessian_eigenthings(

  File "/home/ajinkya/miniconda3/lib/python3.8/site-packages/hessian_eigenthings/__init__.py", line 68, in compute_hessian_eigenthings
    eigenvals, eigenvecs = deflated_power_iteration(

  File "/home/ajinkya/miniconda3/lib/python3.8/site-packages/hessian_eigenthings/power_iter.py", line 43, in deflated_power_iteration
    eigenval, eigenvec = power_iteration(

  File "/home/ajinkya/miniconda3/lib/python3.8/site-packages/hessian_eigenthings/power_iter.py", line 108, in power_iteration
    new_vec = utils.maybe_fp16(operator.apply(vec), fp16) - momentum * prev_vec

  File "/home/ajinkya/miniconda3/lib/python3.8/site-packages/hessian_eigenthings/hvp_operator.py", line 65, in apply
    return self._apply_batch(vec)

  File "/home/ajinkya/miniconda3/lib/python3.8/site-packages/hessian_eigenthings/hvp_operator.py", line 73, in _apply_batch
    grad_vec = self._prepare_grad()

  File "/home/ajinkya/miniconda3/lib/python3.8/site-packages/hessian_eigenthings/hvp_operator.py", line 113, in _prepare_grad
    all_inputs, all_targets = next(self.dataloader_iter)

ValueError: too many values to unpack (expected 2)

Please help to resolve the problem. Thanks.

jiachengc commented 2 years ago

same problem, have you solve this problem?